index exceeds matrix dimension

1 次查看(过去 30 天)
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
  1 个评论
Martin Olafsen
Martin Olafsen 2017-9-27
You're missing a multiplication ("*").
r = ((-1000*p*q)/(27*(30*10^6)*0.163*(p+q)))*(p+(2*q))*((3* --->p<---(p+(2*q)))^0.5);
Use this: r = ((-1000*p*q)/(27*(30*10^6)*0.163*(p+q)))*(p+(2*q))*((3*p*(p+(2*q)))^0.5);
Regards

请先登录,再进行评论。

采纳的回答

KSSV
KSSV 2017-9-27
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);
  2 个评论
Haseeb Ahmed Janjua
please check your gmail email id. I need help in Some patterns
will be grateful on your feedback

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by