# 21 - while error> tol root_old=root root...

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

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 2. x=0:0.01:10; y=2.*exp(x)-8*x.^4; plot(x,y) axis([0 1 0 1]) Guess value is 0.882 3. function y = trajectory (theta) g=9.81; vo=25; x=60; y=(tan(theta))*x-(g*x^2)/(2*(vo)^2*cos(theta)); end function y = trajectory (theta) g=9.81;

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

View Full Document
v=25; x=60; y=((tan(theta))*x)-((g*(x^2))/(2*(v^2)*(cos(theta)^2))); end function [root] = falsepos(k,thetal, thetau) yl = feval(k,thetal); yu = feval(k,thetau); root=thetal; tol=0.001; error=1;
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: while error > tol root_old=root; root =thetau-((yu*(thetal-thetau))/(yl-yu)); yr = feval(k,root); if (yu*yl) < 0 thetal = root; yl = yr; elseif (yu*yl) > 0 thetau = root; yu = yr; else break end error=abs((root-root_old)/root); end root=falsepos( 'trajectory' ,40,80) x=0:100 y=(tan(root).*x)-x.^2*9.81/(25^2*2*(cos(root))^2) plot(x,y) axis([0 100 0 25]) 10 20 30 40 50 60 70 80 90 100 5 10 15 20 25...
View Full Document

{[ snackBarMessage ]}

### Page1 / 3

21 - while error> tol root_old=root root...

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

View Full Document
Ask a homework question - tutors are online