Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Novice at Matlab. Need some help

Status
Not open for further replies.

shaboinkin

Newbie level 2
Newbie level 2
Joined
Apr 26, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,297
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.
 

Have a good slap: plot (abs(Y1)) ;-)
The fft returns an imaginary number (magnitude an phase).
 

You know...I don't know how that one slipped passed me... Now I just feel plain silly lol
Thank you sir
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top