Generate a signal wave - Spectrum using FFT
Mostrar comentarios más antiguos
Problem:
Generate a signal wave: ysignal=1+0.1*cos(2*pi*f1*t) and calculate its spectrum using fft (suppose f1=100.02 MHz)
My Solution:
%%Clear Data
clc;
clear all;
% generate a signal wave
t = 0:0.1:10;
f1 = 100.02*10^6;
y_sig = 1+01*cos(2*pi*f1*t);
plot(f1, fft(y_sig));
What steps should I rewrite?
Thank you
Respuestas (2)
Wayne King
el 11 de Mzo. de 2013
Editada: Wayne King
el 11 de Mzo. de 2013
0 votos
Since this is obviously a homework problem, I'm not going to just give you answer.
But since you included some code as an attempt, I will point out some issues:
- Think about how fast you should sample a signal that has a frequency of 100 MHz. Your sampling interval is 0.1 seconds, or a 10 Hz sampling rate. Is that adequate?
- You have to create a proper frequency vector so you can plot the Fourier transform. If you search the MATLAB doc and this forum, there are many examples of how to do that.
- Think about the Fourier transform, is the Fourier transform of a signal real-valued or complex-valued in general? If it's complex-valued, what would the plot to look like?
Youssef Khmou
el 11 de Mzo. de 2013
hi, the sample rate Fs must be at least twice the maximum frequency contained in the signal :
Generate a signal wave: ysignal=1+0.1*cos(2*pi*f1*t) and calculate its spectrum using fft (suppose f1=100.02 MHz)
Fs=220; % suppose its MHz
t=0:1/Fs:1-1/Fs;
f1=100.02; % suppose its Mhz
ysignal=1+0.1*cos(2*pi*f1*t);
figure, plot(t,ysignal);
L=length(ysignal);
N=ceil(log2(L));
F=fft(ysignal,2^N)/L/2;
f=(Fs/2^N)*(0:2^(N-1)-1);
figure, plot(f,abs(F(1:2^(N-1))));title(' FFT(ysignal)')
xlabel(' Frequency in Mhz');
figure, plot(f,10*log10(abs(F(1:2^(N-1)))));title(' FFT(ysignal), LOG')
xlabel(' Frequency in Mhz');
Categorías
Más información sobre Spectral Measurements en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!