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.

How to write a matlab code to calculate the discrete fourier series

Status
Not open for further replies.

aredhel

Member level 2
Joined
Feb 22, 2008
Messages
50
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,800
DSP - Matlab

Hello there, anyone knows how to write a matlab code to calculate the discrete fourier series and its inverse given by:

37_1217898249.gif


and then verify the code for the following input sequence:

75_1217898349.gif
 

Re: DSP - Matlab

First you have to give the range of n:

n=first:last;

then you can use N-point dft function for MATLAB:

X=fft(x,N);

where fft is "fast fourier transform", and you can find details about it on MATLAB help.
 

Re: DSP - Matlab

Ok, but I am confused about one thing though, the "sin" ... how is it possible to not have a "j" there?
 

DSP - Matlab

j is available there in matlab,what confusion u've in it,don't use fft bcoz it finds fast fouirer transform,where u wrote equations to find out fourier co-effients,just rite code like C
 

Re: DSP - Matlab

you need to create a numerical sequence of x[n] in one period. For example you need n to be 0<n<N. Here's what you do:

% N is the period of the x[n] sequence.
n = 0:N;
x = 1 + sin(n*pi/4) + 2*cos(n*pi/2);
X = fft(x,N);
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top