can we make 3D mash plot from eq y(x)
Afficher commentaires plus anciens
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);
Réponses (2)
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")
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')
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


