MATLAB: Plus-minus function

equationfunctionhomeworkminusplus

How would I do the function
Y=B/2*(1-(4*X.^2)/L^2)*(1-Z.^2/D^2);
but before the B i need a plus and minus sign so the variable Y has all the values for positive and negative

Best Answer

Hi Sean,
You can do something like
Y=B/2*(1-(4*X.^2)/L^2)*(1-Z.^2/D^2);
Y = [Y -Y];
HTH