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)
???

April 21st 2010, 05:31 AM

CaptainBlack

Quote:

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

April 22nd 2010, 03:26 AM

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.

April 22nd 2010, 04:13 AM

CaptainBlack

Quote:

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)