Im putting in my equations wrong and i need help

1 view (last 30 days)
T1=30
T2=45
T3=60
g= 9.81
y0=3.5
v0= 25
d1= (v0.*cosd(T2)/g).*((v0.*sind(T2))+sqrt((v0.*sind(T2))).^(2)+(2.*g.*y0))
x1= linspace(0,d1,200)
y1= ((x1.*tand(30))-(1/2).*(((x1.^2).*(g))./((25).*cosd(30)))+y0)
d2= (v0.*cosd(T2)/g).*(v0.*sind(T2))+sqrt((v0.*sind(T2))).^(2)+(2.*g.*y0);
x2= linspace(0,d2,200);
y2= (x2.*tand(T2))-(1/2).*(((x2).^2).*g)/(v0.*(cosd(T2)).^(2)+y0);
d3= (v0.*cosd(T3)/g).*(v0.*sind(T3))+sqrt(((v0.*sind(T3))).^(2)+(2.*g.*y0));
x3= linspace(0,d3,200);
y3= (x3.*tand(T3))-(1/2).*(((x3).^(2)).*g)/(v0.*(cosd(T3)).^(2) +y0);
y1 = transpose (y1);
y2 = transpose (y2);
y3 = transpose (y3);
plot(x1,y1)
hold on
plot(x2,x3)
hold on
plot(x3,y3)
hold on
here are the equations i need to imput please feel free to tell me if there are other issues

Answers (1)

Sindar
Sindar on 24 Sep 2020
Edited: Sindar on 24 Sep 2020
should that be T1? also, replace 25 hardcoding with v0 (and 30 with T1)
d1= (v0.*cosd(T2)/g).*((v0.*sind(T2))+sqrt((v0.*sind(T2))).^(2)+(2.*g.*y0))
x1= linspace(0,d1,200)
y1= ((x1.*tand(30))-(1/2).*(((x1.^2).*(g))./((25).*cosd(30)))+y0)
otherwise, it looks okay. If you're going to be doing this a lot, I'd define a function for each equation, or at least vectorize the code

Community Treasure Hunt

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

Start Hunting!