How to write umax*exp(1./((th-th0).*(th-th1)))/en for th0<th<th1 in matlab?
1 回表示 (過去 30 日間)
古いコメントを表示
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/247192/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/247193/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/247194/image.png)
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 件のコメント
採用された回答
Walter Roberson
2019 年 11 月 7 日
編集済み: Walter Roberson
2019 年 11 月 7 日
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 件のコメント
Walter Roberson
2019 年 11 月 7 日
Why do you want to write it that way?
Have you considered using piecewise() from the symbolic toolbox?
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!