Mustaine
Member level 1

Hello friends why matlab gives the magnitude fourier transform of cosine as 250.
is not it should be 1/2 according to the equation below.
thanks
this is the matlab code:
i tried to do that on simulink by changing the frequency as 1k .
type of the spectrum power and the unit is watts but i get the magnitude as 0.25.
is that value correct
also the magnitude is varied by the sample time why is that
thanks in advance.
is not it should be 1/2 according to the equation below.
thanks
--- Updated ---
this is the matlab code:
Code:
Tsample = 1/50;
t = 0:Tsample:10-Tsample;
x = cos(2*pi*10*t);
figure
plot(t,x)
xlabel('Time (seconds)')
ylabel('Amplitude')
y = fft(x);
fsample = 1/Tsample;
n = length(x);
fshift = (-n/2:n/2-1)*(fsample/n);
yshift = fftshift(y);
figure
stem(fshift,abs(yshift))
xlabel('Frequency (Hz)')
ylabel('Magnitude')
--- Updated ---
i tried to do that on simulink by changing the frequency as 1k .
type of the spectrum power and the unit is watts but i get the magnitude as 0.25.
is that value correct
also the magnitude is varied by the sample time why is that
thanks in advance.
Attachments
Last edited: