can we make 3D mash plot from eq y(x)
3 次查看(过去 30 天)
显示 更早的评论
I have equation ball trajectory
y=(tand(theta)*x-(g/(2*v0^2*cosd(theta)^2)*x.^2)+y0
i wonder how to make mesh plot when i have no equation z(x,y)=...
i just think that 2D graph can make into 3D, so can i use z =linespace (....)
theta=50;
g=9.81;
v0=25;
y0=1;
fun=@(x) (-1)*(tand(theta)*x-(g/(2*v0^2*cosd(theta)^2)*x.^2)+y0);
0 个评论
回答(2 个)
Sulaymon Eshkabilov
2023-3-17
You can consider the following code for 3D simulation of the projectile:
% Projectile motion simulation for t = [0 : 25] seconds
t = linspace(0, 25);
theta=50;
g=9.81;
V0=25; % Initial Velcoity in [m/s]
y0=1; % Distance in [m]
% Initial Conditions:
X0 = 0.0;
Y0 = 1.0;
Z0 = 0.0;
% initial velocity values [m/s]:
Vx0 = V0*cosd(theta)*sind(theta);
Vy0 = V0*sind(theta)*sind(theta);
Vz0 = V0*cosd(theta);
% Acceleration values [m/s^2]:
Ax0 = 0.0;
Ay0 = 0.0;
Az0 = -9.8;
x = X0 + Vx0*t + 0.5*Ax0*t.^2;
y = Y0 + Vy0*t + 0.5*Ay0*t.^2;
z = Z0 + Vz0*t + 0.5*Az0*t.^2;
% 3D plot
figure(1) % Animated plot
comet3(x,y,z)
figure(2)
plot3(x,y,z,'ro-','markerfacecolor', 'y')
grid on,
view([-30,55])
xlabel('Displacement along x [m]')
ylabel("Position along y [m]")
zlabel("Position along z [m]")
title("3D Projectile Motion Simulation")
0 个评论
Walter Roberson
2023-3-17
syms x theta
g=9.81;
v0=25;
y0=1;
fun = (-1)*(tand(theta)*x-(g/(2*v0^2*cosd(theta)^2)*x.^2)+y0);
fsurf(fun, [0 300, 0 90])
xlabel('x'); ylabel('theta')
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!