how to display multiple graphs ??
Mostrar comentarios más antiguos
Hi, i am working on PAPR in OFDM.i have difficulties in modifying the code below so that i can display PAPR for totalSubcarrier=64,256 on the same graph?This code only display totalSubcarriers=256
function paprOFDMA()
dataType = 'Q-PSK'; % Modulation format.
totalSubcarriers = 256; % Number of total subcarriers.
numSymbols = 16; % Data block size.
Fs = 5e6; % System bandwidth.
Ts = 1/Fs; % System sampling rate.
Nos = 4; % Oversampling factor.
Nsub = totalSubcarriers;
Fsub = [0:Nsub-1]*Fs/Nsub; % Subcarrier spacing
numRuns = 1000; % Number of runs.
papr = zeros(1,numRuns); % Initialize the PAPR results.
for n = 1:numRuns,
% Generate random data.
if dataType == 'Q-PSK'
tmp = round(rand(numSymbols,2));
tmp = tmp*2 - 1;
data = (tmp(:,1) + j*tmp(:,2))/sqrt(2);
elseif dataType == '16QAM'
dataSet = [-3+3i -1+3i 1+3i 3+3i ...
-3+i -1+i 1+i 3+i ...
-3-i -1-i 1-i 3-i ...
-3-3i -1-3i 1-3i 3-3i];
dataSet = dataSet / sqrt(mean(abs(dataSet).^2));
tmp = ceil(rand(numSymbols,1)*16);
for k = 1:numSymbols,
if tmp(k) == 0
tmp(k) = 1;
end
data(k) = dataSet(tmp(k));
end
data = data.';
end
% Time range of the OFDM symbol.
t = [0:Ts/Nos:Nsub*Ts];
% OFDM modulation.
y = 0;
for k = 1:numSymbols,
y= y + data(k)*exp(j*2*pi*Fsub(k)*t);
end
% Calculate PAPR.
papr(n) = 10*log10(max(abs(y).^2) / mean(abs(y).^2));
end
%Plot CCDF.
[N,X] = hist(papr, 100);
semilogy(X,1-cumsum(N)/max(cumsum(N)),'b')
xlabel('papr, x dB')
ylabel('ccdf')
% Save data.
save paprOFDMA
2 comentarios
Image Analyst
el 23 de Dic. de 2012
Editada: Image Analyst
el 23 de Dic. de 2012
Yeah, but we hate it when people edit their questions to delete/obliterate them. It's disrepectful of the people who took the time to help you, and denies others who are seeking help on a similar situation the benefit of context for the answers (which are still there by the way) because they don't know what you asked. Destroying your post is a good way to get people to ignore your questions in the future. For a variety of reasons, people often look up your prior questions before answering your latest question.
Randy Souza
el 26 de Dic. de 2012
I have restored the original text of this question.
sarah, this question has a clear subject and an accepted answer, so it may be valuable to someone else in the future. If you have a good reason why it should be removed from MATLAB Answers, please flag the question, explain why it should be deleted, and an administrator or high-reputation contributor will consider deleting the question. Please do not simply edit your question away.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Test and Measurement en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!