T = 3*(1/25);
fs = 1000;
t = 0:1/fs:T-1/fs;
x = sawtooth(2*pi*25*t,1/2);
x = (x + 1)*0.5;
subplot(3,1,1)
plot(t,x)
grid on
xlabel('Time t (sec)')
ylabel('Amplitude')
I want to take DFT(Discrete Fourier Transform) of my signal using FFT and FFTShift and find frequency spectrum. However,the graphics I found did not seem right to me. Is there anyone who can help? If there are errors in what I do, I want to find and fix it.
Following code for second graph:
y = fft(x);
n = length(x);
f = (0:n-1)*(fs/n);
power = abs(y).^2/n;
subplot(3,1,2)
plot(f,power)
xlabel('Frequency')
ylabel('Power')