MATLAB: Index exceeds matrix dimension

index exceeds matrix dimension

whenever I create this function in editor
function r = Ymaxfinal(p,q)
r = ((-1000*p*q)/(27*(30*10^6)*0.163*(p+q)))*(p+(2*q))*((3*p(p+(2*q)))^0.5);
end
but when I call it in command window like Ymaxfinal(9,8)
it gives the error of Index exceeds matrix dimensions. plz help me

Best Answer

Change this line:
r = ((-1000*p*q)/(27*(30*10^6)*0.163*(p+q)))*(p+(2*q))*((3*p(p+(2*q)))^0.5);
to
r = ((-1000*p*q)/(27*(30*10^6)*0.163*(p+q)))*(p+(2*q))*((3*p*(p+(2*q)))^0.5);
Related Question