diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /845/CH6/EX6.14/Ex6_14.sce | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '845/CH6/EX6.14/Ex6_14.sce')
-rwxr-xr-x | 845/CH6/EX6.14/Ex6_14.sce | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/845/CH6/EX6.14/Ex6_14.sce b/845/CH6/EX6.14/Ex6_14.sce new file mode 100755 index 000000000..dd0d0a424 --- /dev/null +++ b/845/CH6/EX6.14/Ex6_14.sce @@ -0,0 +1,23 @@ +//Example 6.14
+
+clc
+clear
+
+x = [1 3 4 6];
+y = [-3 0 30 132];
+
+n = length(x);
+Y = 0;
+X = poly(0, "X");
+//X = 5;
+for i = 1:n
+ t = x;
+ t(i) = [];
+ p = 1;
+ for j = 1:length(t)
+ p = p * (X-t(j))/(x(i)-t(j));
+ end
+ Y = Y + p*y(i);
+end
+Y5 = horner(Y,5);
+disp(Y5,"y(5) = ")
|