How to solve this error for the calculation of PVmax2? : Array indices must be positive integers or logical values.
2 ビュー (過去 30 日間)
古いコメントを表示
Af= 0.5 ;
Vmax = 33.3333; % Vehicle maximum Speed: 120 Km/h
VGmax= 5.55556; % Vehicle maximum speed at maximum grade (30 degrees)
Vcr = 22.2222; % Crusing Speed : 80 km/h
Mw = 1300;
g = 9.81;
row = 1.1; % Air Density
Cd = 0.0145; % coefficient of drag
mue = 0.015;
alpha = 0;
PVmax1 = (0.5 * row * Cd * Af *(Vmax^2)) + (Mw*g*Vmax(cos(alpha)+ (mue*sin(alpha))));
P1 = ['Average Power to maintain maximum speed = ',num2str(PVmax1), ' Watts'];
disp(P1)
GMax = 30; % maximum vehicle grade
PVmax2 = (0.5 * row * Cd * Af *(VGmax^2)) + (Mw*g*VGmax(cos(GMax)+ (mue*sin(GMax))));
P2 = ['Maximum power at Maximum Grade = ',num2str(PVmax2), ' Watts'];
disp (P2)
0 件のコメント
採用された回答
Star Strider
2019 年 2 月 2 日
My guess is that you’re missing an operator (possibly a ‘*’ for multiplication) here (note ↑):
PVmax1 = (0.5 * row * Cd * Af *(Vmax^2)) + (Mw*g*Vmax(cos(alpha)+ (mue*sin(alpha))));
↑
and:
PVmax2 = (0.5 * row * Cd * Af *(VGmax^2)) + (Mw*g*VGmax(cos(GMax)+ (mue*sin(GMax))));
↑
Anyway, when I insert asterisks in thole locations, your code runs.
2 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!