# EQ/UFRJ Carlos André Vaz Junior

## Presentation on theme: "EQ/UFRJ Carlos André Vaz Junior"— Presentation transcript:

EQ/UFRJ Carlos André Vaz Junior cavazjunior@gmail.com http://www.eq.ufrj.br/links/h2cin/carlosandre

EQ/UFRJ fsolve

EQ/UFRJ solucao = fsolve('funcao',[2],optimset('Display','iter')) function [y] = funcao(x) y=2*x+1; principal.m

EQ/UFRJ solucao = fsolve('funcao',[2],optimset('Display','iter')) function [y] = funcao(x) y=2*x^2+x-2; principal.m

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:

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)

EQ/UFRJ A=roots([8 4 -2]) Achando todas as raízes do polinômio:

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;

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