Generate a signal wave - Spectrum using FFT

2 vues (au cours des 30 derniers jours)
hussein Diab
hussein Diab le 11 Mar 2013
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

Réponses (2)

Wayne King
Wayne King le 11 Mar 2013
Modifié(e) : Wayne King le 11 Mar 2013
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:
  1. 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?
  2. 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.
  3. 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
Youssef Khmou le 11 Mar 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');

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by