I want to implement the above formula in single line without using if statment.
I have tried but geting error at X=0.
X=-4:1:4;L=2;A=1.6732;Z= ((max(X,0)./X).*(X.*L))+((min(0,X)./X).*(L.*(A.*exp(X)-A)))
Need to have zero at X=0.
nonlinear
X=-4:1:4;L=2;A=1.6732;Z= ((max(X,0)./X).*(X.*L))+((min(0,X)./X).*(L.*(A.*exp(X)-A)))
Best Answer