Im putting in my equations wrong and i need help
1 次查看(过去 30 天)
显示 更早的评论
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/365128/image.jpeg)
0 个评论
回答(2 个)
VBBV
2023-4-24
There are several changes needed in your equations, please look at the comments in the code where the changes are necessary
T1=30;
T2=45;
T3=60;
g= 9.81;
y0=3.5;
v0= 25;
% below line, you need to use T1 in place of T2
d1= (v0.*cosd(T1)/g).*(v0.*sind(T1)+sqrt((v0.*sind(T1)).^2+(2.*g.*y0)));
% ^T1 instead of T2 ^ T1 ^ T1
x1= linspace(0,d1,200);
y1= x1.*tand(T1)-(1/2).*((x1.^2.*g)./(v0.*cosd(T1)).^2)+y0;
% ^^ square term is
% missing and parenthesis
% closed incorrectly
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;
% ^^same here
d3= (v0.*cosd(T3)/g).*(v0.*sind(T3)+sqrt((v0.*sind(T3)).^2+(2.*g.*y0)));
x3= linspace(0,d2,200);
y3= x3.*tand(T3)-(1/2).*((x3.^2.*g)./(v0.*cosd(T3)).^2)+y0;
% ^^ same here
y1 = transpose (y1);
y2 = transpose (y2);
y3 = transpose (y3);
hold on
plot(x1,y1)
plot(x2,x3)
plot(x3,y3)
legend('\Theta = 30^{0}','\Theta = 45^{0}','\Theta = 60^{0}'); grid
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!