You are on page 1of 1

/**

* Program: Fourier analysis


* Author : Muzeyen Hassen
* Date : 2012/04/07
* License: BSD, GPL(V2), or other in agreement with Walid Taha
**/
class Main(simulator)
private S=1; t=0; t'=0; signal1=0; signal2=0; signal3=0; signal4=0; signal5=0
; signal_sum=0; x=0; x'=0 end
simulator.endTime=10;
simulator.timeStep=0.01;
t'[=]1;
x'[=]1;
if x>0.5 x=0;
if S==-1 S=1 else S=-1 end
end;
signal1[=]sin(2*3.1416*t); //first harmonic
signal2[=](1/3)*sin(6*3.1416*t);
signal3[=](1/5)*sin(10*3.1416*t) + (1/7)*sin(14*3.1416*t) + (1/9)*sin(18*3.1416*
t) + (1/11)*sin(22*3.1416*t);
signal4[=](1/13)*sin(26*3.1416*t) + (1/15)*sin(30*3.1416*t) + (1/17)*sin(34*3.14
16*t) + (1/19)*sin(38*3.1416*t);
signal5[=](1/19)*sin(38*3.1416*t);
signal_sum[=](signal1 + signal2 + signal3 + signal4 + signal5);
end