index exceeds matrix dimension

3 Ansichten (letzte 30 Tage)
Haseeb Ahmed Janjua
Haseeb Ahmed Janjua am 27 Sep. 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 Kommentar
Martin Olafsen
Martin Olafsen am 27 Sep. 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

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by