summaryrefslogtreecommitdiff
path: root/149/CH10/EX10.3/ques3.sce
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /149/CH10/EX10.3/ques3.sce
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '149/CH10/EX10.3/ques3.sce')
-rwxr-xr-x149/CH10/EX10.3/ques3.sce13
1 files changed, 13 insertions, 0 deletions
diff --git a/149/CH10/EX10.3/ques3.sce b/149/CH10/EX10.3/ques3.sce
new file mode 100755
index 000000000..5c9878df5
--- /dev/null
+++ b/149/CH10/EX10.3/ques3.sce
@@ -0,0 +1,13 @@
+//ques3
+clc
+disp('finding the fourier series of given function');
+syms x
+ao=1/%pi*(integ(-1*%pi*x^0,x,-%pi,0)+integ(x,x,0,%pi));
+s=ao/2;
+n=input('enter the no of terms upto each of sin or cos terms in the expansion : ');
+for i=1:n
+ ai=1/%pi*(integ(-1*%pi*cos(i*x),x,-1*%pi,0)+integ(x*cos(i*x),x,0,%pi));
+ bi=1/%pi*(integ(-1*%pi*x^0*sin(i*x),x,-1*%pi,0)+integ(x*sin(i*x),x,0,%pi));
+ s=s+float(ai)*cos(i*x)+float(bi)*sin(i*x);
+end
+disp(float(s));