Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A1= [2 4 6 7; 3 6 5 5; 4 2 3 2; 5 1 2 6];
- A2= [1 2 3; 4 5 6; 7 8 9]; %macierz zle uwarunkowana
- A3= [0 0 0; 4 5 6; 7 8 9];
- b1= [21 18 12 15];
- b2= [4 10 16];
- mnoz1= A1*inv(A1)
- mnoz2= A2*inv(A2)
- mnoz3= A3*inv(A3)
- condA1= cond(A1); %wspolczynnik uwarunkowania macierzy
- %||A||/||inv(A)|| = cond(A) > 200 macierz ma trudne wlasnosci
- condA2= cond(A2)
- condA3= cond(A3)
- deta2= det(A2)
- %A1*x1= b1'
- x1= inv(A1)* b1' %b' - transponowana
- E1= A1* x1- b1' %wektor bledu
- e1= norm(E1) %dlugosc wektora bledu
- x2= inv(A2)* b2'
- E2= A2* x2- b2'
- e2= norm(E2)
- x22= A2\ b2' %\ - metoda Gaussa
- E22= A2* x22 -b2'
- e22= norm(E22)
- %III
- x= 0 : 0.2 : 10*pi;
- y1= exp(-x/10);
- y2= y1.* sin(4*x);
- y3= -y1;
- hold on
- figure(1);
- plot(x, y1, 'r')
- plot(x, y2, 'k')
- plot(x, y3, 'b')
- hold off
- %IV
- figure(2);
- [x,y]= meshgrid(-3 : 0.2 : 3);
- z= sin(x).*sin(y).*exp(-x.^2- y.^2);
- subplot(2,2,1);
- mesh(x, y, z);
- shading interp
- subplot(2,2,2);
- surf(x, y, z);
- shading interp
- subplot(2,2,3);
- surfc(x, y, z);
- shading interp
- %V
- zet= @(x) sin(x(1))*sin(x(2))*exp(-x(1)^2- x(2)^2);
- [x, fval2]= fminsearch(zet, [-0.7, 0.7])
- [x, fval4]= fminsearch(zet, [0.7, -0.7])
Advertisement
Add Comment
Please, Sign In to add comment