This commit is contained in:
Andrzej Kokosza 2017-01-26 16:21:51 +01:00
parent 68d7f39fb8
commit 69ccde4d39

39
zajęcia13/octave.m Normal file
View File

@ -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)