index exceeds matrix dimension

16 visualizzazioni (ultimi 30 giorni)
Haseeb Ahmed Janjua
Haseeb Ahmed Janjua il 27 Set 2017
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 Commento
Martin Olafsen
Martin Olafsen il 27 Set 2017
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

Accedi per commentare.

Risposta accettata

KSSV
KSSV il 27 Set 2017
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 Commenti
Haseeb Ahmed Janjua
Haseeb Ahmed Janjua il 27 Set 2017
thanks it works
god bless you
Haseeb Ahmed Janjua
Haseeb Ahmed Janjua il 27 Set 2017
please check your gmail email id. I need help in Some patterns
will be grateful on your feedback

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by