summaryrefslogtreecommitdiff
path: root/413/CH3/EX3.1/Example_3_1.sce
diff options
context:
space:
mode:
Diffstat (limited to '413/CH3/EX3.1/Example_3_1.sce')
-rw-r--r--413/CH3/EX3.1/Example_3_1.sce17
1 files changed, 17 insertions, 0 deletions
diff --git a/413/CH3/EX3.1/Example_3_1.sce b/413/CH3/EX3.1/Example_3_1.sce
new file mode 100644
index 000000000..6b6b409ab
--- /dev/null
+++ b/413/CH3/EX3.1/Example_3_1.sce
@@ -0,0 +1,17 @@
+clc
+clear
+x=[3.2 2.7 1 4.8 5.6]
+y=[22 17.8 14.2 38.3 51.7]
+for i=1:1:5
+X=[x(1,i) y(1,i)]
+disp(X)
+end
+
+P31=(3-x(1,2))*(3-x(1,3))*(3-x(1,4))*(3-x(1,5))*y(1,1)/((x(1,1)-x(1,2))*(x(1,1)-x(1,3))*(x(1,1)-x(1,4))*(x(1,1)-x(1,5)));
+P32=(3-x(1,1))*(3-x(1,3))*(3-x(1,4))*(3-x(1,5))*y(1,2)/((x(1,2)-x(1,1))*(x(1,2)-x(1,3))*(x(1,2)-x(1,4))*(x(1,2)-x(1,5)))
+P33=(3-x(1,2))*(3-x(1,1))*(3-x(1,4))*(3-x(1,5))*y(1,3)/((x(1,3)-x(1,2))*(x(1,3)-x(1,1))*(x(1,3)-x(1,4))*(x(1,3)-x(1,5)))
+P34=(3-x(1,2))*(3-x(1,3))*(3-x(1,1))*(3-x(1,5))*y(1,4)/((x(1,4)-x(1,2))*(x(1,4)-x(1,3))*(x(1,4)-x(1,1))*(x(1,4)-x(1,5)))
+P35=(3-x(1,2))*(3-x(1,3))*(3-x(1,4))*(3-x(1,1))*y(1,5)/((x(1,5)-x(1,2))*(x(1,5)-x(1,3))*(x(1,5)-x(1,4))*(x(1,5)-x(1,1)))
+printf(' Ploynomial at x=3 is')
+P=P31+P32+P33+P34+P35
+disp(P) \ No newline at end of file