Matlab project

Thread Starter

teen devil

Joined Apr 6, 2009
Hey guys i am new to matlab and signal processing i need to submit a project regarding any of the following topics
2.fourier series and transform
4.working with a simple audio signal
if u guys had any coding or idea reply.....
Waiting for ur replys...


Joined Apr 2, 2009
we don't have any ideas buddy.
Ur project, so you have to come up with something and then we will discuss about it.
So post ur project, explain it and if you are having trouble, we will help.


Joined Jan 30, 2010
what can do is look at fourier series and transforms online. there should be some code out. i know one of mathematica that my friend used the other day. works in matlab too. at least it should. was pretty awesome. the plot function was inside the loop. so the graph changed its shape through each iteration or whatever you call it. so check it out and modify it to fit your project. good luck
Last edited:

Thread Starter

teen devil

Joined Apr 6, 2009
jhon... i am not getting u if i put the plot command in loop .. for example i am right shifting the signal by using loop will it show it moving in the final plotting figure???


Joined Jan 30, 2010
i don't know how to explain it. i was going to ask him for the code today but forgot. like i'm guessing a fourier transform calculates n=1, then n=2, n=whatever you specify. and if you plot the function in the loop. the plot updates everytime it calculates the new n. so the graph is moving since it is in the loop.


Joined Jan 30, 2010
i got it from him. hopefully you log on since it is due tomorrow

% Example MATLAB M-file that plots a Fourier series

% Set up some input values.
L = 3 % period = 2*L
Num_Terms = 100 % Approximate infinite series with Num_Terms terms

% Miscellaneous setup stuff
format compact; % Gets rid of extra lines in output. Optional.

% Initialize x axis values from -L to +L. Middle number is step size.
% Make middle number smaller for smoother plots.
x = -L:0.001:L;

% Initialize y-axis values: y = f(x)
f = zeros(size(x));

% Add a0 to series.
a0 = 1/6;
f = f + a0;

% Loop Num_Terms times through Fourier series, accumulating into f.
for n=1:Num_Terms


% Formula for an. It is safer to use lots of parentheses,
% just in case, to make sure things are executed in the order
% that they should be. For example, 2/n*pi is interpreted
% as (2/n)*pi, which is not what I want. Better to write
% (2/(n*pi)) and make sure.
an = (2/(n*pi))*sin(n*pi/L) + (6/(n^2*pi^2))*( cos(n*pi/L) -1 );

% Formula for bn.
bn = 0;

% Add cosine and sine into f.
f = f + an*cos(n*pi*x/L) + bn*sin(n*pi*x/L);

% Plot intermediate f. You can comment these three lines out for
% faster execution speed. The function pause(n) will pause for
% about n seconds. You can raise or lower for faster plots.