Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Altera_Forum

Honored Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-26-2012
10:29 AM

879 Views

dft problem

greetings,

hi i have typed followin code to verify samplng theorem but the answer is coming something different.may i know the reason. clc; fs=800; t=0:1/fs:1 x=cos(2*pi*400*t); xm=(fft(x)); k=0:length(xm)-1; subplot(2,2,1); stem(k,xm) xlabel('hertz') ylabel('magnitude') title('sampling') the result should come at only one frequency(i.e one line at frequency of cosine) as the signal is cosine but spectrum is continious. why ? the spectrum (o/p)is attached here thanks in advanceLink Copied

4 Replies

Altera_Forum

Honored Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-26-2012
11:16 AM

21 Views

You're doing:

t=0:1/fs:1 x=cos(2*pi*400*t); The step is 1/fs, which is 1/800 = 0.00125 This means, that from range 0 to 1, every 0.00125 step You'll get a new frequency (because argument 't' in cosine function is changing), that is: 800 results. So what do You expect in frequency domain to see?
Altera_Forum

Honored Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-26-2012
12:37 PM

21 Views

your frequency is half sampling rate and is one line mirrored

plot(k,abs(xm));
Altera_Forum

Honored Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-28-2012
09:40 AM

21 Views

Altera_Forum

Honored Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-28-2012
09:49 AM

21 Views

But I told you you have got it. Just your plot is wrong.

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.