MATLAB: How to write umax*exp(1​./((th-th0​).*(th-th1​)))/en for th0

arraycell arraymatrix manipulation

, ,
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.

Best Answer

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;