Thread Subject:
A problem in plotting the fourier series !!!!

Subject: A problem in plotting the fourier series !!!!

From: Animesh Pandey

Date: 1 Mar, 2011 17:11:04

Message: 1 of 1

syms an bn a0;
syms t n;
syms x;
y = sym(0);

T=2;
N=13;
x = heaviside(t+0.5)-heaviside(t-0.5); %Square pulse
f = @(t) x;

an = int(f(t).*cos(n*pi*t/T),t,-T,T)*(1/T);
bn = int(f(t).*sin(n*pi*t/T),t,-T,T)*(1/T);
a0 = int(f(t),t,-T,T)*(1/T);
y = a0;

pretty(a0);
pretty(an);
pretty(bn);


for i=-N:2:N;
     y = y + subs(an, i) + subs(bn, i);
end


ezplot(i,y), grid on % Problem point

I am not able to print 'y' which is the fourier series of the square wave !!!!
Please help !!!!

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us