How to write umax*exp(1./((th-th0).*(th-th1)))/en for th0<th<th1 in matlab?
6 views (last 30 days)
Show older comments
Kayode Odeyemi
on 7 Nov 2019
Commented: Walter Roberson
on 7 Nov 2019
, ,
I saw something related to my question
uu = @(th) vif(th>ph0&th<ph1,umax*exp(1./((th-ph0).*(th-ph1)))/en,0)
but unfortunately, 'vif' is not defined. Please I need clarification.
0 Comments
Accepted Answer
Walter Roberson
on 7 Nov 2019
Edited: Walter Roberson
on 7 Nov 2019
Assuming that you have assigned a definite vector of values to th, then:
y = nan(size(th));
mask = th0 < th & th < th1;
y(mask) = umax*exp(1./((th(mask)-th0).*(th(mask)-th1)))/en;
2 Comments
Walter Roberson
on 7 Nov 2019
Why do you want to write it that way?
Have you considered using piecewise() from the symbolic toolbox?
More Answers (0)
See Also
Categories
Find more on Data Types in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!