필터 지우기
필터 지우기

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 CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by