I've used the following code for an equation in MATLAB and it works perfectly well in a script (cp1 and u1 have already been defined):
eqn3 = cp1 == (u1+u4)*(u1.^2-u4.^2)/(2*u1.^3);
u4 = real(U4( U4 > 0 ));
However, when I've tried to implement it into a function it doesn't work.
Can anyone help me with this please?