フィルターのクリア

Dimension and line Error

2 ビュー (過去 30 日間)
Jocelyn
Jocelyn 2020 年 11 月 13 日
回答済み: Alan Stevens 2020 年 11 月 13 日
Good day,
I am recieving two errors in the following code. Your assistance in solving these errors would be much appreciated. Thanks
Error message 1 (Note: there is no 'line 51' in my code. The last line at 'T =' is on line 43:
Error using ^ (line 51)
Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform elementwise matrix powers, use '.^'.
Error message 2
Error in Assign5_Prob7 (line 37)
Vy(i) = (4*Vy_o)/((2+(k3*sqrt(Vx_o)*t(i)))^2) - g*(4*t(i)+(2*k3*sqrt(Vx_o)*t^2)+ ((k3^2*Vx_o*t^3)/3))/((2+(k3*sqrt(Vx_o)*t))^2);
for i = 1:6
x(i) = (i-1)*200*3;
y(i) = (i-1)*200*3;
Vx(i) = (sqrt(Vx_o) - ((k3/2)*x(i)))^2;
t(i) = (x(i)/Vx_o)*sqrt(Vx_o/Vx(i));
Vy(i) = (4*Vy_o)/((2+(k3*sqrt(Vx_o)*t(i)))^2) - g*(4*t(i)+(2*k3*sqrt(Vx_o)*t^2)+ ((k3^2*Vx_o*t^3)/3))/((2+(k3*sqrt(Vx_o)*t))^2);
end
T = table(x(:)/3, x(:), Vx(:), t(:), Vy(:), 'VariableNames',{'yards', 'feet', 'x -vel', 'time of flight', 'y-vel'})

採用された回答

Alan Stevens
Alan Stevens 2020 年 11 月 13 日
It looks like you have some t's in your expression for Vy(i) that should be t(i).

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by