Dimension and line Error

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by