From 69ccde4d391d1a9ede7d2c01fc88a13aa28b08cd Mon Sep 17 00:00:00 2001 From: Andrzej Kokosza Date: Thu, 26 Jan 2017 16:21:51 +0100 Subject: [PATCH] 'octave' --- zajęcia13/octave.m | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 zajęcia13/octave.m diff --git a/zajęcia13/octave.m b/zajęcia13/octave.m new file mode 100644 index 0000000..f5345a1 --- /dev/null +++ b/zajęcia13/octave.m @@ -0,0 +1,39 @@ +#zad1 +A=[2,-2,1,-1;-1,4,-5,3;1,1,-1,1;-4,2,1,-2]; +b=[7;1;4;6]; +x=A\b; +disp(x); +#zad2 +function y = f (x); +y=x^3-21*x+20; +endfunction; + +[x, info] = fsolve("f", 1.2); + +disp(x); +#zad3 +x=-2.0:0.05:2; +y=-2.0:0.05:2; +function y = f (x); +y=x.^2-2*x+3; +endfunction; + +plot(x,f(x)); + +function y = f (x); +y=cos(2*x); +endfunction; + +plot(x,f(x)); + +function y = f (x); +y=sin(1./x); +endfunction; + +plot(x,f(x)); + +[xx,yy]=meshgrid(x,y); + +mesh(xx, yy, xx.^2+yy.^2) + +mesh(xx, yy, xx.^2-yy.^2 + 2*x.*y.^2+1) \ No newline at end of file