0% found this document useful (0 votes)
36 views2 pages

% Fourier Series Calculation of Perioded Function: F (X) X Between - Pi To Pi % Initiating

The document describes calculating the Fourier series of a periodic function f(x)=x between -pi and pi. It defines the function, calculates the Fourier coefficients, sums the series for various values of N, and plots the function and series approximations.

Uploaded by

mohsen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views2 pages

% Fourier Series Calculation of Perioded Function: F (X) X Between - Pi To Pi % Initiating

The document describes calculating the Fourier series of a periodic function f(x)=x between -pi and pi. It defines the function, calculates the Fourier coefficients, sums the series for various values of N, and plots the function and series approximations.

Uploaded by

mohsen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

close all

clear all
clc
% Fourier series calculation of perioded function : f(x)= x between -pi to pi
% initiating
T = 2*pi;
w = (2*pi)/T;
x = -T/2 : 0.01*T : T/2;

% Function plotting:
F = x ;
plot(x , F ,'k');
hold on

% Coefficient of Sin
clear x
syms x n
a_s(n) = ( int( x*sin(n*x*w) ,x,0,T/2) ) * 4/T ;

%Fourier series
x = -T/2 : 0.01*T : T/2;
Sum = 0;

for n = 1 : N

Sum = Sum + ( a_s(n)*sin(n*x*w) );

end

plot( x , Sum , 'r');


grid on

N=1 N=2

N=3 N=5
N = 10 N = 50

N = 100 N = 200

N = 500

You might also like