newtraph - if nargin<5|isempty(maxit,maxit=50;end iter =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function [rt]=newtraph(t,h,es,maxit) g=9.81; w=2*pi/t syms x func=inline(w^2-g*x*tanh (x*h)) dfunc=inline(-9*tanh(x*h)+h*((sech(x*h))^2)*(-g*x)) k=(w^2)/(g*sqrt((w^2*h)/g)) if nargin<3,error('at least 3 input arguments required'),end if nargin<4|isempty(es),es=0.0001;end
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if nargin<5|isempty(maxit),maxit=50;end iter = 0; while (1) xrold = k; k = k - func(k)/dfunc(k); iter = iter + 1; if k ~= 0, ea = abs((k-xrold)/k)*100;end if ea <=es | iter>= maxit, break, end end rt = k;...
View Full Document

This note was uploaded on 03/01/2010 for the course CVEN 302 taught by Professor Edge during the Spring '08 term at Texas A&M.

Ask a homework question - tutors are online