Download presentation
Presentation is loading. Please wait.
1
EQ/UFRJ Carlos André Vaz Junior cavazjunior@gmail.com http://www.eq.ufrj.br/links/h2cin/carlosandre
2
EQ/UFRJ fsolve
3
EQ/UFRJ solucao = fsolve('funcao',[2],optimset('Display','iter')) function [y] = funcao(x) y=2*x+1; principal.m
4
EQ/UFRJ solucao = fsolve('funcao',[2],optimset('Display','iter')) function [y] = funcao(x) y=2*x^2+x-2; principal.m
5
EQ/UFRJ solucao = fsolve('funcao',[-1],optimset('Display','iter')) function [y] = funcao(x) y=8*x^2+4*x-2; solucao = fsolve('funcao',[5],optimset('Display','iter')) Experimente outro chute inicial:
6
EQ/UFRJ close all A=8; B=4; C=-2; x=-2:0.01:2; y=A.*x.^2+B.*x+C; figure(1) plot(x,y) hold on solucao = fsolve('funcao',[2],optimset('Display','iter'),A,B,C) plot(solucao,0,'r*') function [y] = funcao(x,A,B,C) y=A*x^2+B*x+C; figure(1) plot(x,y,'*k') drawnow pause(0.1)
7
EQ/UFRJ A=roots([8 4 -2]) Achando todas as raízes do polinômio:
8
EQ/UFRJ A= 8; B= 4; C= -2; solucao = fsolve('funcao',[-1],optimset('Display','iter'),A,B,C) function [y] = funcao(x,A,B,C) y=A*x^2+B*x+C;
9
EQ/UFRJ solucao = fsolve('funcao',[-4 1],optimset('Display','iter')) function [y] = funcao(x) y(1)= ( x(1).^2 ) - 5 + x(2); y(2)= (2*x(2))-2;
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.