Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %de rezolvat
- %x-2*sin(x)=0
- %grafic
- x=-3:0.01:3;
- y=2*sin(x);
- subplot(2,1,1)
- plot(x,x,'b')
- hold on
- plot(x,y,'r');
- f=@(x) x-2*sin(x);
- fd=@(x) 1-2*cos(x);
- subplot(2,1,2)
- plot(x,f(x));
- hold on
- axis equal
- [z,ni]=Newtons(f,fd,-2,1e-10,0,200)
- plot(z,0,'or')
- [z,ni]=Newtons(f,fd,1,1e-10,0,200)
- plot(z,0,'ok')
- [z,ni]=Newtons(f,fd,0.1,1e-10,0,200)
- plot(z,0,'ob')
- [z,ni]=secant(f,-2,-1,1e-10,0,200)
- [z,ni]=secant(f,2,1,1e-10,0,200)
- [z,ni]=secant(f,0.2,0.1,1e-10,0,200)
- pause
- F=@(x)[x(1)^2+x(2)^2-1;x(1)^3-x(2)]
- Fd=@(x)[2*x(1) 2*x(2);3*x(1)^2 -1]
- [z,ni]=Newton(F,Fd,[1 1],1e-10,0,200)
- [z,ni]=Newton(F,Fd,[-1 1],1e-10,0,200)
- [z,ni]=AproxSucces(F,Fd,[1 1],1e-10,0,200)
- [z,ni]=AproxSucces(F,Fd,[1 -1],1e-10,0,200)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement