From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 758/CH2/EX2.1/Ex_2_1.sce | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 758/CH2/EX2.1/Ex_2_1.sce (limited to '758/CH2/EX2.1/Ex_2_1.sce') diff --git a/758/CH2/EX2.1/Ex_2_1.sce b/758/CH2/EX2.1/Ex_2_1.sce new file mode 100755 index 000000000..1f60ffd26 --- /dev/null +++ b/758/CH2/EX2.1/Ex_2_1.sce @@ -0,0 +1,26 @@ +//Example 2.1 + +clc;clear;close; +A=1;T=2; +w0=2*%pi/T; + +//Calculation of trignometric fourier series co-efficients +a0=A/T*(integrate('-1','t',-T/2,-T/4)+integrate('+1','t',-T/4,T/4)+integrate('-1','t',T/4,T/2)); +for n=1:10; +a(1,n)=2*A/T*(integrate('-cos(n*w0*t)','t',-T/2,-T/4)+integrate('+cos(n*w0*t)','t',-T/4,T/4)+integrate('-cos(n*w0*t)','t',T/4,T/2)); +b(1,n)=2*A/T*(integrate('-sin(n*w0*t)','t',-T/2,-T/4)+integrate('+sin(n*w0*t)','t',-T/4,T/4)+integrate('-sin(n*w0*t)','t',T/4,T/2)); +end + +//Displaying fourier coefficients +disp(T,'fundamental period T= ',A,'Assumption: Amplitude A= '); +disp('Tignometric fourier series co-efficients:'); +disp(a0,'a0= ');disp(a,'an= ');disp(b,'bn= '); + +x=[-A*ones(1,25) A*ones(1,50) -A*ones(1,25)] //Function for ploting purpose +t=-T/2:0.01*T:T/2-0.01; +subplot(311);plot(t,x); +title('x(t)');xlabel('time t'); +subplot(312);plot2d3(a); +title('Coefficients an');xlabel('n'); +subplot(313);plot2d3(b); +title('Coefficients bn');xlabel('n'); \ No newline at end of file -- cgit