Dimension and line Error
1 view (last 30 days)
Show older comments
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'})
0 Comments
Accepted Answer
Alan Stevens
on 13 Nov 2020
It looks like you have some t's in your expression for Vy(i) that should be t(i).
0 Comments
More Answers (0)
See Also
Categories
Find more on Point Cloud Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!