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
Best Answer