### Eloy Rodríguez (view profile)

on 27 Feb 2012

clear all disp('x^4-8*x^3+39*x^2-62*x+50 ') a(1)=1; a(2)=-8; a(3)=39; a(4)=-62; a(5)=50; pol=[a(1),a(2),a(3),a(4),a(5)]; r=input('Valor r\n'); s=input('Valor s\n'); %comienzo de la iteración for w=1:12 for i=1:(length(pol)); if i==1 vr(i)=0; vs(i)=0; b(i)=a(i); elseif i==2; vr(i)=r; vs(i)=0; b(i)=a(i)+r; elseif i==3; vr(i)=b(i-1)*r; vs(i)=s; b(i)=a(i)+vr(i)+vs(i); else vr(i)=r*b(i-1); vs(i)=s*b(i-2); b(i)=a(i)+vr(i)+vs(i); end end b; for i=1:((length(b))-1); if i==1 vr(i)=0; vs(i)=0; c(i)=b(i); elseif i==2; vr(i)=r; vs(i)=0; c(i)=b(i)+r; elseif i==3; vr(i)=c(i-1)*r; vs(i)=s; c(i)=b(i)+vr(i)+vs(i); else vr(i)=r*b(i-1); vs(i)=s*b(i-2); c(i)=b(i)+vr(i)+vs(i); end end c; d=[c(3),c(2)]; j=[c(4),c(3)]; m=[d;j]; o=[-b(4)]; p=[-b(5)]; n=[o;p]; nd=(d/c(3))*c(4); nj=nd-j; no=(o/c(3))*c(4); np=p-no; nm=[nd;nj]; nn=[no;np]; ds=np/nm(4); dr=((-nm(2)*ds)+nn(1))/nm(1); r=r+dr s=s+ds end

I apologize if its a bit messy, I just wanted to know how to determine when I've found one of the roots, I know is with the porcentual error, but apparently none of the error is lower than 1%????? Thank you.

## Products

No products are associated with this question.

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi