Register to reply

Matlab fourier series

by Jovany_17
Tags: fourier, matlab, series
Share this thread:
Jovany_17
#1
Aug18-14, 12:39 PM
P: 2
HI plz help me this could someone verify it for me plz find attachement

clc;
clear all;
k=0;
s=0;
N=inf;
for i=1:N
s=s+(1/(k^2+1));
k=k+1;
end

syms x n
a0=1/pi*int(cosh(x),-pi,pi);
an=1/pi*int(cosh(x)*cos(n*x),-pi,pi);
bn=1/pi*int(cosh(x)*sin(n*x),-pi,pi);

fs=0;

for l=0:100
fs=fs+(an*cos(l*x)+bn*sin(l*x))
end

fs-fs+a0/2;
Attached Thumbnails
TD.jpg  
Phys.Org News Partner Mathematics news on Phys.org
Math journal puts Rauzy fractcal image on the cover
Heat distributions help researchers to understand curved space
Professor quantifies how 'one thing leads to another'
mathman
#2
Aug18-14, 03:17 PM
Sci Advisor
P: 6,104
Quote Quote by Jovany_17 View Post
HI plz help me this could someone verify it for me plz find attachement

clc;
clear all;
k=0;
s=0;
N=inf;
for i=1:N
s=s+(1/(k^2+1));
k=k+1;
end

syms x n
a0=1/pi*int(cosh(x),-pi,pi);
an=1/pi*int(cosh(x)*cos(n*x),-pi,pi);
bn=1/pi*int(cosh(x)*sin(n*x),-pi,pi);

fs=0;

for l=0:100
fs=fs+(an*cos(l*x)+bn*sin(l*x))
end

fs-fs+a0/2;
The calculation of s looks OK. It could have been done slightly easier.
N=inf;
s=1;
for k = 1:N
s=s+(1/(k^2+1));
end
The Fourier series sum has a couple of errors. I would do the following:
fs = a0/2;
N = inf;
for n = 1:N
fs=fs+(an*cos(n*x)+bn*sin(n*x));
end
Jovany_17
#3
Aug18-14, 03:35 PM
P: 2
Thanks

mathman
#4
Aug19-14, 03:27 PM
Sci Advisor
P: 6,104
Matlab fourier series

A further simplification: Except for a0, the values of an and bn can be calculated inside the loop, so they don't have to be stored in advance.


Register to reply

Related Discussions
Need help plotting Fourier series in matlab Math & Science Software 6
Matlab - The Fourier Series Math & Science Software 4
Matlab and fourier series Math & Science Software 0
Fourier Series using MATLAB Calculus & Beyond Homework 2
Fourier series in matlab Math & Science Software 3