2_Junak_Blake_LabHW10A

2_Junak_Blake_LabHW10A - 2.9688 2.9688 2.8125 2.8906 2.8906...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Blake Junak Section 2 function [xr]=LabHW10A(xl,xu) %Blake Junak %Section 2 %This function will determine the roots of a polynomal function %These are the original functions f_xu=-1.2*(xu^2)+1.35*xu+5.9; f_xl=-1.2*(xl^2)+1.35*xl+5.9; %If function if f_xl*f_xu>0 error( 'error' ) end %While function while abs(xu-xl)>.001 xr=(xl+xu)/2; f_xr=-1.2*(xr^2)+1.35*xr+5.9; if f_xl*f_xr<0 xu=xr; elseif f_xl*f_xr>0 xl=xr; else break end f_xl=-1.2*(xl^2)+1.35*xl+5.9; f_xu=-1.2*(xu^2)+1.35*xu+5.9; disp([xl,xu,xr]) end >> xl=0 xl = 0 >> xu=5 xu = 5 >> [xr]=LabHW10A(xl,xu) 2.5000 5.0000 2.5000 2.5000 3.7500 3.7500 2.5000 3.1250 3.1250
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2.8125 3.1250 2.8125 2.8125
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 2.9688 2.9688 2.8125 2.8906 2.8906 2.8125 2.8516 2.8516 2.8320 2.8516 2.8320 2.8418 2.8516 2.8418 2.8467 2.8516 2.8467 2.8491 2.8516 2.8491 2.8491 2.8503 2.8503 2.8497 2.8503 2.8497 xr = 2.8497 &gt;&gt; xl=0 xl = &gt;&gt; xu=-5 xu =-5 &gt;&gt; [xr]=LabHW10A(xl,xu) 0 -2.5000 -2.5000-1.2500 -2.5000 -1.2500-1.2500 -1.8750 -1.8750-1.5625 -1.8750 -1.5625-1.7188 -1.8750 -1.7188-1.7188 -1.7969 -1.7969-1.7188 -1.7578 -1.7578-1.7188 -1.7383 -1.7383-1.7188 -1.7285 -1.7285-1.7236 -1.7285 -1.7236-1.7236 -1.7261 -1.7261-1.7249 -1.7261 -1.7249-1.7249 -1.7255 -1.7255 xr =-1.7255 &gt;&gt;...
View Full Document

Page1 / 3

2_Junak_Blake_LabHW10A - 2.9688 2.9688 2.8125 2.8906 2.8906...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online