# MAT2002 Lab: Applications of Differential and Difference Equations Lab

Want to contribute and get featured here? Mail us at **[email protected]**

Experiment-3 (Harmonic Analysis-1)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | clear all clc syms t n=6; x_0=0; s=1; y= [1 2 3 4 5 6] n1=2 x=x_0+(0:5)*s l=(0.5)*(x(n)+s-x(1)) a0=(2/n)*sum(y) F_s=(a0)/2; for i=1:n1 yc=y.*(cos((i*pi*x)/l)); ys=y.*(sin((i*pi*x)/l)); a(i)=(2/i)*sum(yc); b(i)=(2/i)*sum(ys); F_s=F_s+a(i).*(cos(i*pi*t/l))+b(i).*(sin(i*pi*t/l)) end disp(F_s) |

Experiment-3(Harmonic Analysis-2)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | clear all clc syms t n=6; x_0=0; s=30; y= [1 5 12 20 25 31] n1=2 x=x_0+(0:5)*s x=x*pi/180; s=s*pi/180; l=(0.5)*((x(n)+s)-x(1)) a0=(2/n)*sum(y) F_s=(a0)/2 for i=1:n1 yc=y.*(cos((i*pi*x)/l)); ys=y.*(sin((i*pi*x)/l)); a(i)=(2/i)*sum(yc); b(i)=(2/i)*sum(ys); F_s=F_s+a(i).*cos(i*pi*t/l)+b(i).*sin(i*pi*t/l); end disp(F_s) |