01-06-2009 10:09 AM
Hi,
i'm having a go at using mathscript but i seem to have hit a problem, i'm having trouble figuring out how to get a root finding system going.
say something simple like find the value that cos(x) = 0 around 3, so acording to an example i saw you would put:
x=fzero(@cos,3)
but this returns an error saying '@' is unrecognised.
simularly if you wished to look for this value say between 1 and 5 you would put in:
x=fzero(@cos, [1,5])
am i getting mixed up with Matlab syntax or am i doing it completly wrong??
HELP!!
01-06-2009 10:55 PM
Hi,
MathScript can not recognize symbol @.
The syntax of fzero is
y = fzero(fun, y0);
where fun is a sting input specifying the name of the function and y0 is a scalar specifying the initial guess for the zero. Therefore, you should use the following script to find zero of cos near 3.
x = fzero('cos', 3)
You can just type 'help fzero' in MathScript Windows to get detail help and example of this functioin.
01-07-2009 04:31 AM
Hi, i'm still being dim.
i've attatched a vi that i think i've done what you said.
its lv 8.2.
any help apreciated.
John P.
01-07-2009 09:33 AM
01-07-2009 10:46 AM
dang... that would explain it.
i guess a code could be wrote to do it.