[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Piecewise function in octave
From: |
John W. Eaton |
Subject: |
Re: Piecewise function in octave |
Date: |
Wed, 15 Oct 2008 18:31:02 -0400 |
On 15-Oct-2008, genehacker wrote:
| Can you please tell what .* do to the equation.
Although it is far from perfect, there are around 600 pages of
documentation in the Octave manual, and the .* operator does appear in
the index...
| f(t) = a(t) t < t0
| b(t) t = t0
| c(t) t > t0
You can write
function result = f (t, t0)
if (t < t0)
result = a (t);
elseif (t == t0)
result = b (t);
else
result = c (t);
endif
endfunction
Here I'm assuming T and T0 are scalars and A, B, and C are other
functions. If you meant something else, then state it more precisely
and maybe someone can help you.
jwe