I tried to solve projectile motion problem (velocity about physic) with matlab . I have some troubles ... Please help me immediately
Show older comments
g=9.80665;
T=37;
V0=100;
Vx=(V0*cos(T))
Vy=abs(V0*sin(T))
tu=(Vy/g)
t=(1:tu) --------------- When I changed like that t=(1:0.1:tu) / float
Programme gives error like that:
Array indices must be positive integers or logical values.
Error in V_T (line 9)
y(t)=(Vy-g*(t))
y(t)=(Vy-g*(t)
x(t)=Vx
y2(t)=(-Vy-g*(t))
A=[y(t),y2(t)]
B=[x(t),x(t)]
V=A.^2+B.^2
1 Comment
William Rose
on 3 Feb 2022
y=Vy-g*t; %should work
If T is in degrees (which it appears to be), then you should use
Vx=V0*cosd(T);
Vy=V0*sind(T);
Also, x(t)=... and y2(t)=... will produce errors, and you shoudl use x=... and y2=...
Check the right hand side of your equations. Are they correct?
Accepted Answer
More Answers (1)
William Rose
on 3 Feb 2022
I inteneded to make an answer not a comment.
y=Vy-g*t; %should work
If T is in degrees (which it appears to be), then you should use
Vx=V0*cosd(T);
Vy=V0*sind(T);
Also, x(t)=... and y2(t)=... will produce errors, and you shoudl use x=... and y2=...
Check the right hand side of your equations. Are they correct?
1 Comment
Sevval Zengin
on 3 Feb 2022
Categories
Find more on Mathematics 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!