Maple piecewise to MATLAB
Mostra commenti meno recenti
Hi,
I am learning Matlab and stumble on this. I have an expression in Maple and trying to write it in Matlab but my basic knowledge plus some search went down the drain. So, I am here seeking some help.
In Maple: result:= (tb,t,tr,i)->piecewise(t<=tb,0 ,tb<t and t<=tb+tr, i*t, t>tb+tr and t<=500, 100, t>500,t-100);
In simple terms:
tb >= t then 0
tb < t <= tb+tr then i*t
tb+tr < t <= 500 then 100
500 < t then t-100
Now, t varies from 1 to 100 with 100 points. [ linspace(1,100,100]
What would be the equivalent of this expression in Matlab?
Many thanks in advance.
Risposta accettata
Più risposte (1)
John D'Errico
il 28 Apr 2011
0 voti
The simple answer is to download my piecewise_eval from the file exchange.
John
1 Commento
Bibha
il 28 Apr 2011
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!