39 lines
524 B
Matlab
39 lines
524 B
Matlab
#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) |