# Math Help - octave and multi-criterion-function

1. ## 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)
???

2. Originally Posted by abdolah
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

3. 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.

4. Originally Posted by abdolah
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]