Error Using Plot for a Derived Fourier Transform Signal
Afficher commentaires plus anciens
I derived the Fourier Transform of a signal analytically, and I am trying to plot its magnitude with respect to frequency. However, I keep getting the following error "Vectors must be the same length". I tried using linspace but I am not sure if I implemented it correctly.
clc;
BW=3000;
Fs=2*BW;
Ts=1/fs;
Tend=3;
Tend=ceil(Tend/Ts)*Ts;
N=(Tend/Ts)+1;
To=N*Ts;
Fo=1/To;
t=(0:Ts:(N-1)*Ts);
Freq=(-Fs/2:Fo:Fs/2-Fo);
G1=3*10^-3.*sinc(pi*f/1000).^2.*exp(-1i*pi*f/125);
G2=3*10^-3.*sinc(pi*f/2000).^2.*exp(-1i*pi*f/225);
Gf_Derived=(G1-G2);
figure(1)
plot(Freq,abs(Gf_Derived),'Linewidth',2)
grid on
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Spectral Measurements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!