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

MATLAB simulation question.

 
Post new topic  Reply to topic    EDAboard.com Forum Index -> Digital communication
Author Message
seadolphine2000



Joined: 12 Apr 2005
Posts: 563
Helped: 31


Post28 Mar 2006 21:38   MATLAB simulation question.

I want to make Fourier Trasnform to a continous signal and then plot the spectrum of this signal. Does anyone know how can I do it.????

I tried to use the FFT command for a simple function (sinx) but it gives wrong results.

Any help will be appreciated. Thanks Smile
Back to top
mimomod



Joined: 25 Jan 2006
Posts: 110
Helped: 15


Post28 Mar 2006 22:02   MATLAB simulation question.

Hi,

i think it is not possible to define a continuous signal in matlab since matlab only dealing with discrete-time signal. Nevertheless you may substitute the continuous signal ith a "pseudo" continuous signal which is a discrete-time signal with a very high frequency sampling (e.g. 10 times as the Nyquist frequency).

Consequency, when you plot the spectrum of sinx based on its "pseudo" representation, you will not get just an impulse at -f and +f, but you will get two dominant (higher magnitude) pulses at -f and +f and many side-lobes (less magnitude). When the sampling frequency of the "pseudo" continuous signal gets higher, then the pulses get closer to impulses and the side-lobes get vanished.

best
Back to top
Sal



Joined: 29 Nov 2005
Posts: 291
Helped: 36


Post28 Mar 2006 23:10   MATLAB simulation question.

HI it is possible if you have the Symbolic Toolbox

syms y x
y = sin(x);
Y = fourier(y);
ezplot(Y)

viola

Sal
Back to top
mimomod



Joined: 25 Jan 2006
Posts: 110
Helped: 15


Post29 Mar 2006 11:17   MATLAB simulation question.

Yes if you have the symbolic toolbox, but seadolphine2000 did the Fourier analysis using FFT function, which is not symbolic.

best
Back to top
magnetra



Joined: 21 Apr 2005
Posts: 264
Helped: 3
Location: 27.45N, 85.20E KTM, NP


Post29 Mar 2006 15:51   Re: MATLAB simulation question.

This may be helpful

http://www.edaboard.com/viewtopic.php?t=136295&highlight=

here is the link from UTexas Matlab support:

http://www.utexas.edu/math/Matlab/Manual/tec6.2.html

Regards
Magnetra
Back to top
seadolphine2000



Joined: 12 Apr 2005
Posts: 563
Helped: 31


Post30 Mar 2006 23:27   Re: MATLAB simulation question.

Viola wrote:
Quote:
HI it is possible if you have the Symbolic Toolbox

syms y x
y = sin(x);
Y = fourier(y);
ezplot(Y)


Thanks to your help but,...

I've tried this code and it gives me errors.

What shall I do now.?
Back to top
matchasm



Joined: 14 Mar 2006
Posts: 23


Post31 Mar 2006 2:39   Re: MATLAB simulation question.

seadolphine2000 wrote:
What shall I do now.?


Assuming you don't know too much about Matlab, try "doc fft" in the command window. It gives you this nice little example:

**********

Examples

A common use of Fourier transforms is to find the frequency components of a signal buried in a noisy time domain signal. Consider data sampled at 1000 Hz. Form a signal containing 50 Hz and 120 Hz and corrupt it with some zero-mean random noise:
Code:
t = 0:0.001:0.6;
x = sin(2*pi*50*t)+sin(2*pi*120*t);
y = x + 2*randn(size(t));
plot(1000*t(1:50),y(1:50))
title('Signal Corrupted with Zero-Mean Random Noise')
xlabel('time (milliseconds)')


It is difficult to identify the frequency components by looking at the original signal. Converting to the frequency domain, the discrete Fourier transform of the noisy signal y is found by taking the 512-point fast Fourier transform (FFT):
Code:
Y = fft(y,512);


The power spectrum, a measurement of the power at various frequencies, is
Code:
Pyy = Y.* conj(Y) / 512;


Graph the first 257 points (the other 255 points are redundant) on a meaningful frequency axis:
Code:
f = 1000*(0:256)/512;
plot(f,Pyy(1:257))
title('Frequency content of y')
xlabel('frequency (Hz)')


This represents the frequency content of y in the range from DC up to and including the Nyquist frequency. (The signal produces the strong peaks.)
Back to top
seadolphine2000



Joined: 12 Apr 2005
Posts: 563
Helped: 31


Post01 Apr 2006 0:44   MATLAB simulation question.

I've tried this code before, but it didn't give me the expected results.
Back to top
davyzhu



Joined: 23 May 2004
Posts: 530
Helped: 3
Location: oriental


Post01 Apr 2006 3:42   MATLAB simulation question.

Hi,

I recommend the code from:
http://www.billauer.co.il/easyspec.html

Tell me if the code is right, thanks!

Regards,
Davy
Back to top
Post new topic  Reply to topic    EDAboard.com Forum Index -> Digital communication
Page 1 of 1 All times are GMT + 2 Hours


Abuse
Administrator
Moderators
topic RSS 
sitemap