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)

???

Printable View

- Apr 21st 2010, 06:09 AMabdolahoctave 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)

??? - Apr 21st 2010, 06:31 AMCaptainBlack
- Apr 22nd 2010, 04:26 AMabdolah
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. - Apr 22nd 2010, 05:13 AMCaptainBlack
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

[/code]