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 --- 1670/CH5/EX5.53/5_53.sce | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 1670/CH5/EX5.53/5_53.sce (limited to '1670/CH5/EX5.53') diff --git a/1670/CH5/EX5.53/5_53.sce b/1670/CH5/EX5.53/5_53.sce new file mode 100755 index 000000000..431ce19bc --- /dev/null +++ b/1670/CH5/EX5.53/5_53.sce @@ -0,0 +1,34 @@ +//Example 5.53 +//Spline Interpolation +//Page no. 206 +clc;close;clear; + +xi=[1,2,3]; +yi=[-3,4,23]; +h=1;n=2; +x=poly(0,'x') +m(2)=(6*(yi(3)-2*yi(2)+yi(1)))/4 +m(1)=0;m(3)=0; +function [y]=S(i,x) + y=m(i)*(xi(i+1)-x)^3/(6*h) + y=y+m(i+1)*(x-xi(i))^3/(6*h) + y=y+(yi(i)/h-(m(i)*h)/6)*(xi(i+1)-x) + y=y+(yi(i+1)/h-(m(i+1)*h)/6)*(-xi(i)+x) +endfunction +for i=1:2 + S1(i)=S(i); +end +printf('\n The required Spline is : \n') +disp(' ','2=1 & x<=2 then + i=1; +else x>2 & x<=3 + i=2; +end +disp(S(i,x),'y(1.5) = ') +x=1;h1=0.01; +for i=1:1 + Sd(i,x)=(S(i,x+h1)-S(i,x))/h1 +end +disp(Sd(1,1),'y`(1) = ') \ No newline at end of file -- cgit