Do anyone know how to graph your function in the interval from x=0 to inf
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Phong Do
el 16 de En. de 2021
Comentada: Phong Do
el 17 de En. de 2021
So i have a problem to find the equation of motion of rocket and plotting it, but when plotting the graph it keeps plotting the part where x is negative
Here it's my code, can someone help me to only plot the part where x>0
Many thanks in advance
syms t positive rational
disp ('Choose upward direction as positive direction');
disp ('Choose ground as the origin of coordinates');
fprintf ('The Newton''s second law equation for rocket motion: ');
disp ('m*dv/dt = -v0*dm/dt - mg');
k = input('Input the fuel combustion speed dm/dt = ');
m0 = input('The rocket''s mass m0 = ');
y0 = input('The rocket''s initial position y0 = ');
v0 = input('The rocket''s gas propulsion speed v0 = ');
g = 9.81;
v = v0*log(m0/(m0-k*t))-g*t;
a = diff(v,t);
fprintf ('The rocket''s acceleration: a = ');
disp (a);
y = y0 + int(v,0,t);
fprintf ('the equation of rocket motion : y =');
disp (y);
fplot(y);
title('Graph of the motion''s equation');
xlabel('Time t');
ylabel('Position y');
grid on;
0 comentarios
Respuesta aceptada
Steven Lord
el 16 de En. de 2021
The fplot function allows you to specify the range of x over which you want your function to be plotted.
syms x
fplot(sin(x), [0 4*pi])
But you're not going to be able to achieve the goal in your question as stated unless you have an infinitely wide monitor. You could pan the axes to see the plot for larger and larger values of x, but you're never going to be able to get an infinitely wide view.
Más respuestas (0)
Ver también
Categorías
Más información sobre Argument Definitions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!