help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Calling fsolve from C++


From: vicmota
Subject: Calling fsolve from C++
Date: Fri, 2 May 2014 19:17:52 -0700 (PDT)

Hello,

I'm a Computer Engineering undergrad student from Brazil and saw a reply in
a thread about using fsolve function inside a C++ program. The post
contained this hints:

1a. prepare your objective function as a C++ function, using Octave's 
Array classes as inputs/outputs 
1b. wrap it in an octave_builtin object 
OR 
1ab. prepare your objective as an m-file function 
2. initialize Octave interpreter 
3. call fsolve through the feval interface (parse.h) 

Could you present me a working example in this case? How can I define a
non-linear function just using Array classes? I managed to use feval
interface to run fzero function, but passing an inline function handle and
it works. But how can I represent this set of functions in C++?

function y = f (x)
  y = zeros (2, 1);
  y(1) = x(1)^2 + x(2)^2 - 36;
  y(2) = x(1)^2 - x(2)^2 - 1;
endfunction

[xy, fval] = fsolve ('f', [-5; 5]);

King regards,
Victor Nascimento



--
View this message in context: 
http://octave.1599824.n4.nabble.com/Calling-fsolve-from-C-tp4663888.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]