Results 1 to 4 of 4

Math Help - octave and multi-criterion-function

  1. #1
    Newbie
    Joined
    Apr 2010
    Posts
    14

    octave and multi-criterion-function

    how we can declare a multi-criterion-function in octave?
    i know that for functions we can write:
    f=inline("x^3+4*x^2-10");
    but how we can write:
    f=0 x=0
    else f=xln(x)
    ???
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by abdolah View Post
    how we can declare a multi-criterion-function in octave?
    i know that for functions we can write:
    f=inline("x^3+4*x^2-10");
    but how we can write:
    f=0 x=0
    else f=xln(x)
    ???
    You could try putting the function definition in a .m file.

    It can be done inline but it is trick code and I won't show you how to do it that way.

    CB
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Apr 2010
    Posts
    14
    ok ,but how i declare it in .m file?
    do i must write it with conditional commands as if or ....
    if you can please explain more.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by abdolah View Post
    ok ,but how i declare it in .m file?
    do i must write it with conditional commands as if or ....
    if you can please explain more.
    You open an editor and type in the function definition using as many lines as you need then save it with an appropriate name with a .m extension (I don't recall if Octave automatically loads .m files on the search path with the same name as an unknown function or if you will have to load it explicity)

    Code:
    function ReturnValue=FunctionName( .... )
      
      ... code calculating the required value for ReturnValue
     
      ReturnValue= ...
    end
    CB

    [/code]
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Integral of a multi-part function
    Posted in the Calculus Forum
    Replies: 13
    Last Post: November 22nd 2011, 03:29 PM
  2. Replies: 0
    Last Post: July 16th 2011, 12:14 PM
  3. Replies: 0
    Last Post: February 26th 2011, 05:03 PM
  4. Criterion Function, corner points
    Posted in the Calculus Forum
    Replies: 5
    Last Post: October 18th 2010, 09:33 AM
  5. Replies: 1
    Last Post: April 2nd 2010, 07:58 PM

Search Tags


/mathhelpforum @mathhelpforum