From: Walter Roberson <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Newton-Raphson
Date: Thu, 08 Apr 2010 18:21:07 -0500
Organization: Canada Eat The Cookie Foundation
Lines: 33
Message-ID: <hplod5$le9$>
References: <hf6s0i$bhl$> <hpl2a7$cka$> <hpl3jj$jm7$> <hpl4no$ode$> <hpl9do$sai$> <hplhhm$qpo$> <hpljpa$ecm$> <hplkne$fbu$> <hpllok$hac$> <hplnb9$mgb$>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: 1270768869 21961 (8 Apr 2010 23:21:09 GMT)
NNTP-Posting-Date: Thu, 8 Apr 2010 23:21:09 +0000 (UTC)
User-Agent: Thunderbird (X11/20100317)
In-Reply-To: <hplnb9$mgb$>
Xref: comp.soft-sys.matlab:624866

Muhamad wrote:
> Walter Roberson <> wrote in message 
> <hpllok$hac$>...

>> When you have a function, the only values that you can use in the 
>> function are numeric constants, named constants such as pi, values you 
>> have already computed in the routine, and values that you have named 
>> after the '(' on the 'function' line.

> why but still error ?
> ------
> ??? Input argument 'teta' is undefined.
> Error in ==> C:\Documents and Settings\madz\My 
> Documents\Downloads\elda\func.m
> On line 4  ==> f = cos(A)-sin(teta)*e^(-(180+A-teta)/W*R);
> Error in ==> C:\Documents and Settings\madz\My 
> Documents\Downloads\elda\Newton_Raphson.m
> On line 11  ==> while (iterations<30) & (abs(func(x))>tolerance)

If we look at that last error message, we see that you are calling func() 
passing in only x. Inside func, you attempt to use teta. Review the paragraph 
I have quoted above. Is teta a numeric literal, a named constant such as pi, a 
value already computed in func(), or a variable you have named after the '(' 
of the 'function' line of func()? If the latter, have you passed in a value 
for teta from the calling routine?

I never claimed to have fixed all of the problems in your code: I showed you 
what was wrong with a particular routine and why, and assumed you would be 
apply to take those explanations and apply the thought processes to your other 
routines and fix them yourself.