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.

question on signal sampling in matlab

Status
Not open for further replies.

abhigopal

Member level 3
Joined
Dec 21, 2004
Messages
61
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
624
signal sampling in matlab

Hi all
I need to sample a signal that is actually a generated by adding some sine waves together, say abt 5 of them all having different frequencies.
for generating these waves, i did the following
t=0:0.1:1 % this the samples tht need to be generated for sine wave
x=sin(2*pi*10*t) % 10 is the freq
now for sampling this signal at say 25 hz or any freq greater than 20, what do i do? do i need to modify t values or write some extra piece of code.
I know this is a very basic question but I am having doubts all of a sudden
An early reply is appreciated
Thanks in advance
Abhi
 

Hi....

After all, you must define a sample frequency. According to Nyquist theorem, you must sample at least twice greater frequency. Actually, it would be better increasing sample frequency to reach more accuracy.

Once upon you have choose a sample frequency (Fs), you may redefine a time vector as:

t = 0 : 1/Fs : Np/Fs

where N is number of samples. Next, you calculate the function applying this.
Apply fft function (Nf at least with 1024 points)

Y=abs(fft(y,Nf));

But you need a frequency vector to plot fft.

f=Fs*(0:Nf/2-1)/Nf;

In order get only frequencies below Fs/2 frequency

plot(f,Y(1:Nf/2))
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top