-1
$\begingroup$

I tried to get power spectrum of ofdm passband signal. Below is the whole matlab code for that with BPSK+ofdm. and I got the power spectrum as below. I wonder that is that right form or not?

full span main band

Nfft=64; % number of sub carriers
Ncp=Nfft/4; % number of cyclic prefix
Nuc=52; % number of used carriers

d=2*(randn(1,Nuc)>0.5)-1; % bpsk mapped data

X=zeros(1,Nfft);
X([2:Nuc/2+1,(end-Nuc/2)+1:end])=d; % only used sub carrier
x=ifft(X,Nfft); % time domain
sbb=[x(end-Ncp+1:end) x]; % to add cyclic prefix

%% passband 

fc=4; % carrier frequency
sps=16; % samples per symbol
Tsym=1; % symbol duration time
Ts=Tsym/sps; % sampling time
fs=1/Ts;

Tmax=(Nfft+Ncp)*sps*Ts-Ts;
t=0:Ts:Tmax;

%return

% I-ch up-sampling
I=real(sbb);
I=repmat(I,sps,1);
I=I(:).';
sI=I.*cos(2*pi*fc*t);

% Q-ch up-sampling
Q=imag(sbb);
Q=repmat(Q,sps,1);
Q=Q(:).';
sQ=Q.*-sin(2*pi*fc*t);

s=sI+sQ; % transimt signal

%% plot power spectrum

f=(0:(numel(s)-1))/numel(s)*fs;

figure
plot(f,10*log10(abs(fft(s))))
%plot(f/1e6,10*log10(abs(fft(s))))
xlabel('frequency[Hz]');
ylim([-40 20]);
title('full span');
grid on

figure
plot(f,10*log10(abs(fft(s))))
%plot(f/1e6,10*log10(abs(fft(s))))
xlabel('frequency[Hz]');
ylim([-40 20]);
xlim([3 5])
title('main band');
grid on
$\endgroup$

1 Answer 1

0
$\begingroup$

Doesn't look right. a 64-FFT with only the center 52 carriers occupied should look pretty "rectangular".

I'd recommend not doing the upconversion. OFDM is designed to be an equivalent-baseband system, so you can definitely investigate whether your OFDM works directly in baseband. It's way more intuitive that way.

$\endgroup$
2
  • $\begingroup$ Thank you for your comment. Using the matlab code above, the spectral shape for the baseband sbb variable shows a right angle shape as you say. As you said, if there is a problem with the waveform of the passband, please explain which part of the matlab code above. [![baseband][1]][1] [1]: i.stack.imgur.com/w3H1P.png $\endgroup$
    – agile
    Mar 24, 2021 at 12:41
  • 1
    $\begingroup$ well, I think that's up to you to debug. Generally, I would recommend not mixing things up – it simply has no benefit, unless you're planning to simulate any nonlinear channels. Also, mixing up could be represented by two lines of code: multiplication with a complex sinusoid, and then deletion of the imaginary part. So, honestly, not debugging your code! $\endgroup$ Mar 24, 2021 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.