summaryrefslogtreecommitdiff
path: root/1670/CH9/EX9.5/9_5.sce
diff options
context:
space:
mode:
Diffstat (limited to '1670/CH9/EX9.5/9_5.sce')
-rwxr-xr-x1670/CH9/EX9.5/9_5.sce20
1 files changed, 20 insertions, 0 deletions
diff --git a/1670/CH9/EX9.5/9_5.sce b/1670/CH9/EX9.5/9_5.sce
new file mode 100755
index 000000000..b7a05a065
--- /dev/null
+++ b/1670/CH9/EX9.5/9_5.sce
@@ -0,0 +1,20 @@
+//Example 9.5
+//Difference Equation
+//Page no. 291
+clc;clear;close;
+
+y(1)=1.5;y(2)=3;
+n=poly(0,'n')
+x=poly(0,'x')
+f=x^2-2*x+1;
+disp(f)
+x=roots(f)
+disp(x,"x = ")
+A=[1,1;1,2];
+B=[y(1);y(2)]
+C=inv(A)*B
+for i=1:2
+ printf('\nc(%i) = %g\n',i,C(i))
+end
+yn=C(1)+C(2)*n
+disp(yn,"yn = ") \ No newline at end of file