LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fzero - zero finder numerically in LabVIEW - NOT based on formula

Hello All.

Does anybody have a simmilar function to Matlab "fzero" in LabVIEW?

I do not need anything less advanced?

thanks in advance
Pawel
0 Kudos
Message 1 of 9
(4,749 Views)
Hello Pawel

Have you checked out the functions in the palette "All Functions < Analyze < Mathematics < Zeros... They might be what you are looking for.

Mohadjer
0 Kudos
Message 2 of 9
(4,749 Views)
I want to use fzero to minimise a function of many variables, but with only one variable to be minimised. The other are just constants. In MATLAB I would do this by using something like :

x=fzero(@(x) myfun(x,a,b,c),x0)

where x is the variable to be minimised.

Unfortunately MathScript doesn't seem to accept the handle @, which leaves me stuck. Any ideas how to get round this problem?

Many thanks,
Steve.
0 Kudos
Message 3 of 9
(4,543 Views)
Sorry I did actually mean find the zero of the function, not minimise it.
0 Kudos
Message 4 of 9
(4,536 Views)
Hi Steve8.5,

Mathscript does accept the fzero function. Here is a link for the syntax.

I hope this helps!
Warm regards,
Karunya R
National Instruments
Applications Engineer
0 Kudos
Message 5 of 9
(4,518 Views)
I know that fzero can be used, and works fine with one variable. My question was regarding finding the zero for a function of more than one variable, but with only one to be changed i.e. not a system of equations.
0 Kudos
Message 6 of 9
(4,513 Views)
Hi Steve8.5,

Have you tried using fsolve? Here is a link to explain the difference between fzero and fsolve.


Warm regards,
Karunya R
National Instruments
Applications Engineer
0 Kudos
Message 7 of 9
(4,485 Views)
Yes, and that has exactly the same problem, as the problem is with the use of @ rather than with fzero itself. However, I have worked out a solution using global variables instead, so that my function can be of just one variable with the other variables passed to it by making them global.
0 Kudos
Message 8 of 9
(4,473 Views)
Hello Steve,

MathScript does not support the @ syntax, as you note.  A workaround is to simply type the name of the function you wish to call.  For example,
x=fzero('myfun', x0);

Also, the function parameters currently only accept one argument.  This is a limitation we are aware of.  The global variable route is the workaround we recommend.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 9 of 9
(4,388 Views)