Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

Help me to compute the power spectrum for a sampled signal using Matlab

Status
Not open for further replies.

MATLAB

Newbie level 1
Joined
Feb 13, 2006
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,288
Hi!
I have a question on MATLAB as follows:
The signal x(t) = sin(ω1t) , given ω1 = 5 , is sampled at 7 samples/sec during8 sec. Compute the power spectrum for the sampled signal.
Can any body help me with that?
thanks
 

claudiocamera

Full Member level 4
Joined
Aug 19, 2005
Messages
225
Helped
27
Reputation
54
Reaction score
6
Trophy points
1,298
Location
Salvador-BA-Brazil
Activity points
4,282
Question on MATLAB

Unless some adjustment in frequency axis, you can start trying the code below.

>> w1=5;
>> t=0:1/7:8;
>> ws=7;
>> x=sin(w1*t);
>> Xw=abs(fftshift(fft(x)));
>> Ws=[-28:28]*ws;
>> plot(Ws,Xw)
 

shirzadi

Newbie level 4
Joined
Dec 20, 2005
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,342
Re: Question on MATLAB

correct Matlab Code is:

>> w1=5;
>> t=0:1/7:8;
>> ws=7;
>> x=sin(2*pi*w1*t);
>> Xw=abs(fftshift(fft(x)));
>> Ws=[-28:28]*ws;
>> plot(Ws,Xw)
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top