fft of Rectangle*sin function in MATLAB
Afficher commentaires plus anciens
Hi!
I would like to analyze the Fourier Transform of the signal that consists of multiplication of sin and rectangular functions.
I am doing it in the way representing in the code and I would expect to obtain a sinusoidal signal that is "bordered" by the rectangular one. For this purpose, I have selected the period of the rectangular signal equal to T = 0.02s and correspondingly the frequency of the sin signal 1/0.02 = 50 Hz.
The problem is that I obtain an error which forces me to use an elementwise multiplication of the signals (which apparently would not be a correct way).
In the frequency domain I would expect to obtain two sinc-functions that are shifted to the left and to the right by 50Hz/2 (Doppler effect), however the result is a straight line.
What am I doing wrong?
Thank you in advance!
Regards
Rostyslav
close all
clear
Ts = 0.01; N=2000; t=-20:Ts:(N-1)*Ts;
T = 0.02;
fs=1/Ts;
f=0:fs/N:(N-1)/N*fs;
x1 = rectpuls(t, T)*sin(2*pi*1/T*t); %error is here. Elementwise multiplication
xk=fft(x1);
figure(1); plot(t,x1);
figure(2); plot(f, 1/N*abs(xk(1:length(f))));
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Parametric Spectral Estimation 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!