[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Qustion about data range selection
From: |
Jordi Gutiérrez Hermoso |
Subject: |
Re: Qustion about data range selection |
Date: |
Sat, 7 Jan 2012 13:28:47 -0500 |
On 7 January 2012 13:08, Klaartje en Mathieu Melenhorst
<address@hidden> wrote:
> In MathCad I used the boolean "if" to change a mathematic operation,
> depending on the input data.
>
> t:=0,(pi/100)..4pi
>
> y(t):=|sin(t) if t<=2pi
> |cos(t) if t>2pi
>
>
> How can this be implemented in Octave?
Use the ifelse command:
t = linspace(0, 4*pi, 100);
y = ifelse(t <= 2*pi, sin(t), cos(t))
HTH,
- Jordi G. H.