Need Urgent Help
1 view (last 30 days)
Show older comments
clear all; clc; close all;
K = 128; % SIZE OF OFDM Symbol
IF = 2; % Interpolation factor (Oversampling factor)
N = K*IF; % SIZE OF FFT
CR = 4; % Clipping ratio (linear 4 <==>log 6dB)
QPSK_Set = [1 -1 1i -1i];
ITERATE_NUM = 4;
MAX_SYMBOLS = 1e4;
PAPR_Orignal = zeros(1,MAX_SYMBOLS);
PAPR_RCF = zeros(ITERATE_NUM,MAX_SYMBOLS);
for nSymbol=1:MAX_SYMBOLS
Index = RANDI(1,K,length(QPSK_Set))+1;
X = QPSK_Set(Index(1,:)); % Orignal Frequency domain signal
XX = [X(1:K/2) zeros(1,N-K) X(K/2+1:K)];
x = ifft(XX,[],2); % Time domain signal
Signal_Power = abs(x.^2);
Peak_Power = max(Signal_Power,[],2);
Mean_Power = mean(Signal_Power,2);
PAPR_Orignal(nSymbol) = 10*log10(Peak_Power./Mean_Power);
for nIter=1:ITERATE_NUM
% Clipping
x_tmp = x(Signal_Power>CR*Mean_Power);
x_tmp = sqrt(CR*Mean_Power)*x_tmp./abs(x_tmp);
x(Signal_Power>CR*Mean_Power) = x_tmp;
% Filtering
XX = fft(x,[],2);
XX(K/2+(1:N-K)) = zeros(1,N-K);
x = ifft(XX,[],2);
% PAPR Compute
Signal_Power = abs(x.^2);
Peak_Power = max(Signal_Power,[],2);
Mean_Power = mean(Signal_Power,2);
PAPR_RCF(nIter,nSymbol) = 10*log10(Peak_Power./Mean_Power);
end
end
[cdf0, PAPR0] = ecdf(PAPR_Orignal);
[cdf1, PAPR1] = ecdf(PAPR_RCF(1,:));
[cdf2, PAPR2] = ecdf(PAPR_RCF(2,:));
[cdf3, PAPR3] = ecdf(PAPR_RCF(3,:));
[cdf4, PAPR4] = ecdf(PAPR_RCF(4,:));
%--------------------------------------------------------------------------
semilogy(PAPR0,1-cdf0,'-b',PAPR1,1-cdf1,'-r',PAPR2,1-cdf2,'-g',PAPR3,1-cdf3,'-c',PAPR4,1-cdf4,'-m')
legend('Orignal','One clip and filter','Two clip and filter','Three clip and filter','Four clip and filter')
xlabel('PAPR0 [dB]');
ylabel('CCDF (Pr[PAPR>PAPR0])');
xlim([0 12])
grid on
when i run the following coding a error message comes as follows , and script is stop running.
??? Attempt to execute SCRIPT clipping as a function: C:\Users\SHEHAN\Desktop\clipping.m
please some one help me its really urgent unable eto find the error..have to amend it soon as possible.
1 Comment
Answers (1)
Walter Roberson
on 21 Mar 2011
Rename C:\Users\SHEHAN\Desktop\clipping.m to something else. You have accidentally used the same name as the name of an internal function, and your version is trying to take precedence over the internal version.
0 Comments
See Also
Categories
Find more on Test and Measurement in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!