regarding use of fzero in octave.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

regarding use of fzero in octave.

Srinivasan Kalyanam
Hi all,
       I have started using octave recently and i am having problem in using the fzero and fsolve functions. I tried to google but did not work. I have a function as follows

function y=tc(x,c,d)
 y=exp(x) - x^2 + 3*x - 2+c-d;
endfunction

            I am trying to findout value of x at which the above expression is zero.  When I give c & d as global variables and give
x=fzero(@tc,1,options), it works.  However, when I try to pass c & d also

x=fzero(@tc(1,0.3,-0.3),1,options), I get following error

error: fzero: subscript indices must be either positive integers less than 2^31 or logicals
error: called from
    fzero at line 158 column 10
  can somebody help.  I have installed the optimization package.


Thank you
With sincere regards

K. Srinivasan
TC 55/2508 (26), Flat 2B, Sreedevi Apartments,
Near MMRHS School, Neeramankara,
Kaimanam P.O.,
Thiruvanthapuram - 695 040
India
Ph:   -00-91-92495-83843
Email:[hidden email]
      [hidden email]


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: regarding use of fzero in octave.

Nir Krakauer-2
try

x = fzero (@(x) tc (x, 0.3, -0.3), 1);


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: regarding use of fzero in octave.

Doug Stewart-4


On Mon, Feb 8, 2016 at 4:57 PM, Nir Krakauer <[hidden email]> wrote:
try

x = fzero (@(x) tc (x, 0.3, -0.3), 1);


_

What is tc? 
DAS


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: regarding use of fzero in octave.

Nir Krakauer-2
In reply to this post by Nir Krakauer-2
the user-defined function of 3 variables from the original post​

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave