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.

DSP Sampling Theorem MATLAB Questions

Status
Not open for further replies.

dav_mt

Newbie level 5
Joined
Oct 12, 2006
Messages
10
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
Malta
Activity points
1,367
sampling theorem matlab

Hello ppl, i m questioning myself why is this happening.

ive implemented the following system using Simulink. basically i am feeding a 1kHz pure sinewave and multiplying it by a pulse having a period of 10 samples and pulse width is 1sample(10us). So effectively sine wave is being sampled at 10kHz.

When i set the simulation time to 10ms and obtain the frequency magnitude spectrum the amplitudes of my frequencies vary (number of samples here is 0 to 1000 therfore 1001)

When i set the simulation time to 9.99ms and obtain the frequency magnitude spectrum the amplitudes now remain constant ! ( 0 to 999 equals 1000 samples)

So why does varying the number of samples(through simulation time) has such a drastic effect? To transform into frequency domain, Matlab's fft function is used. Ive tried to check out doc fft to see wheter the number of samples have effect on the amplitude but I cant actually figure out whats happening.

this is the Matlab code being used,

stem(y,'b.-') <---- Time Plot OK
freq = fft(y) <---- changing signal to frequency domain
plot([0:length(y) - 1], abs(freq)) <----- Frequency Spectrum

note y is the number of samples

attached is a link to the simulink system
**broken link removed**
 

sampling theorem in matlab

Hi,

You need to study some basic DFT theory and realtions between time frequency domain. DFT supposes periodic signals with infinite duration. Also you need some informations about windowing functions and spectrum estimation.
 

    dav_mt

    Points: 2
    Helpful Answer Positive Rating
matlab program for sampling theorem

thanks for your quick reply, i will search something regarding discrete fourier transform even though i havent covered it yet in class. I assume its got to do with the way matlab carries out the dft.
 
matlab code for sampling theorem

Hero is correct. It's not a MATLAB issue, it's a fundamental issue. If you compute the DFT of a periodic waveform, but you take a non-integer number of waveform cycles, you have a discontinuity, so you will see energy spread across the spectrum plot.

Consider what would happen if you repeatedly played that 9.99ms segment to your computer speakers. A small piece of the last waveform cycle is missing, so you will hear the sinewave plus a slight buzzing sound. That buzzing is the energy you see spread across the spectrum plot.

Remember this experience as you learn about weighting!
 
sampling theorem dsp

Try sample the sinewave at 4KHz, 8KHz or 16KHz, i.e., keep fs=2^n*fc, n=1,2,3,4...
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top