shaboinkin
Newbie level 2
Hi, I'm having some trouble in this assignment.
I'm supposed to decimate a signal by a factor of two, plot it in the time domain, then plot the spectrum of the decimated signal in the interval (-pi,pi)
I already plotted the input signal down and the fft of that signal, and this is my code for the decimated signal.
n = 0:.5:40;
f = 10000;
fs = 100000;
x = sin(2 * pi * f/fs * n);
M = 2; %Signal is decimated by a factor of two
Y = decimate(x,M); %decimating the input signal by a factor of two
subplot(3,3,4),plot(Y);
title('Decimated Signal')
y1 = fft(Y); %Applying the fast Fourier transform of the decimated signal
subplot(3,3,5),plot(y1)
title('Decimated FFT')
Y1 = fftshift(y1);
subplot(3,3,6),plot(Y1)
title('Decimated FFT Shift')
and this is what I get from the code
**broken link removed**
I'm just using the code in my book and have been stuck with those weird triangle shaped graphs for the decimated signal. I know the solution will probably make me slap myself, but any hints as for what is wrong would be very helpful.
I'm supposed to decimate a signal by a factor of two, plot it in the time domain, then plot the spectrum of the decimated signal in the interval (-pi,pi)
I already plotted the input signal down and the fft of that signal, and this is my code for the decimated signal.
n = 0:.5:40;
f = 10000;
fs = 100000;
x = sin(2 * pi * f/fs * n);
M = 2; %Signal is decimated by a factor of two
Y = decimate(x,M); %decimating the input signal by a factor of two
subplot(3,3,4),plot(Y);
title('Decimated Signal')
y1 = fft(Y); %Applying the fast Fourier transform of the decimated signal
subplot(3,3,5),plot(y1)
title('Decimated FFT')
Y1 = fftshift(y1);
subplot(3,3,6),plot(Y1)
title('Decimated FFT Shift')
and this is what I get from the code
**broken link removed**
I'm just using the code in my book and have been stuck with those weird triangle shaped graphs for the decimated signal. I know the solution will probably make me slap myself, but any hints as for what is wrong would be very helpful.