electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

DSP Sampling Theorem MATLAB Questions


Post new topic  Reply to topic    EDAboard.com Forum Index -> Digital Signal Processing -> DSP Sampling Theorem MATLAB Questions
Author Message
dav_mt



Joined: 12 Oct 2006
Posts: 11
Location: Malta


Post07 Nov 2006 19:58   

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
DSP Sampling Theorem MATLAB Questions
Back to top
Hero



Joined: 06 Mar 2002
Posts: 145
Helped: 2


Post07 Nov 2006 22:12   

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.
Back to top
Google
AdSense
Google Adsense




Post07 Nov 2006 22:12   

Ads




Back to top
dav_mt



Joined: 12 Oct 2006
Posts: 11
Location: Malta


Post07 Nov 2006 22:36   

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.
Back to top
echo47



Joined: 07 Apr 2002
Posts: 4206
Helped: 566


Post08 Nov 2006 0:46   

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!
Back to top
bcl



Joined: 24 Sep 2006
Posts: 41
Helped: 5


Post08 Nov 2006 5:49   

sampling theorem dsp


Try sample the sinewave at 4KHz, 8KHz or 16KHz, i.e., keep fs=2^n*fc, n=1,2,3,4...
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Digital Signal Processing -> DSP Sampling Theorem MATLAB Questions
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
Sampling theorem (6)
Sampling Theorem (4)
nyquist's theorem and shannon's theorem (3)
dsp peripheral for higher sampling frequency (6)
sampling matlab (1)
question on signal sampling in matlab (1)
sampling discrete time signals in matlab (4)
sampling in Cadence and fft in Matlab (8)
matlab problem, about the sampling rate. (9)
Basic questions on dsp processors (2)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS