1
votes

I'm trying to do some calculations on a signal. The signal is supposed to be a measured reading from a rfid tag modulated by a block wave around 40 kHz on a carrier wave of 868 MHz. The signal I have is sampled at 250 MHz giving me 1250005 samples that are stored in this .mat file.

Now I would like to plot the spectrum x[n]. What I'm told to do is do a fft on it of a segment of 1024 samples. Or use Matlabs PSD function. But I'm struggling with this. This is my Matlab code so far:

load antenna_1;
x = channel_1;

Fs = 250e6; % Sampling frequency 
t = (0:length(channel_1)-1)*1/Fs; % Time vector 
nfft = 1024; % Length of FFT

X = fft(x,nfft);
X = X(1:nfft/2);
mx = abs(X);
f = (0:nfft/2-1)*Fs/nfft; % Frequency vector

plot(t,x);
xlabel('Time (s)'); ylabel('Amplitude');
figure(2);
plot(f,mx);
xlabel('Frequency (Hz)'); ylabel('Power');

This last plot shows me one frequency component around 119 MHZ. Now that's not completely weird because of the aliasing from the 868 MHz signal 868 - 3*250 = 118. But I'm still not quite sure if this is indeed the correct spectrum of my signal? And how would I use the psd function to get the spectrum?

1
Your code and the resulting figure look fine to meLuis Mendo
I was expecting to see multiple repetitions of the signal due to aliasing, shouldn't I see those?fsfikke
Only one such repetition falls within the observed frequency span (0 -- Fs/2)Luis Mendo
The psd function is deprecated, you are supposed to use pwelch instead, which is in the signal-analysis toolbox. For correctly estimating the spectrum of a measured signal, this function is much better than doing some FFTs by hand.Bas Swinckels
@BasSwinckels thank you, I was trying to figure out how to exactly implement this function. This is what I used: load antenna_1; x = channel_1; Fs = 250e6; Nfft = 1024; [Pxx,freq] = pwelch(x,hamming(Nfft),[],[],Fs); plot(freq,Pxx); This gives a similar result as before, but still only shows the one component at 120MHz, how would I be able to see more than that?fsfikke

1 Answers

0
votes

You've guys been really helpful, thanks for that!

So I used pwelch instead, with following code:

load antenna_1;
x = channel_1;

Fs = 250e6;
Nfft = 2^10;
[Pxx,freq] = pwelch(x,hamming(Nfft),[],[],Fs);

figure;
plot(freq,Pxx);

Now this works fine and I get roughly the same looking result as before. But now I would like to shift the component that's at ~119MHz to zero. So to get from x[n] to w[n] in this scheme. To do that I'm applying following multiplication:

n = 0:1:Nfft-1;
w = linspace(0,2*pi,Nfft/2+1);

Pmult = Pxx.*exp(-1j*pi*2);
F = exp(-j*w*119e6).*Pxx';

figure;
plot(freq,abs(Pmult));

However I can't seem to get the component to shift at all with this?