Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function x = method_Newton(f, df, x0, eps)
- x=x0-double(subs(f,x0))/double(subs(df,x0));
- while(abs(x-x0)>eps)
- x0=x;
- x=x0-double(subs(f,x0))/double(subs(df,x0));
- end
- end
- %main
- syms x;
- eps = input('Enter eps: ');
- x0 = input('Enter x0: ');
- f = input('Enter your function: ');
- df = diff(f,x);
- x = method_Newton(f,df,x0,eps)
- %sr4
- %задание 1
- A = input('Enter the matrix of system: ');
- b = input('Enter the vector b: ');
- detA=det(A);
- i=1:size(A);
- B1=A; B2=A; B3=A; B4=A;
- B1(i,1)=b(i);
- B2(i,2)=b(i);
- B3(i,3)=b(i);
- B4(i,4)=b(i);
- [det(B1)/detA det(B2)/detA det(B3)/detA det(B4)/detA]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement