Azzera filtri
Azzera filtri

Dimension and line Error

2 visualizzazioni (ultimi 30 giorni)
Jocelyn
Jocelyn il 13 Nov 2020
Risposto: Alan Stevens il 13 Nov 2020
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'})

Risposta accettata

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

Più risposte (0)

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by