Plotting more than one graph onto a 3d plot

6 visualizaciones (últimos 30 días)
matlab_day
matlab_day el 30 de En. de 2021
Comentada: Walter Roberson el 30 de En. de 2021
Despite having used the hold on function the code below only gives me 1 curve for an ODE I wish to plot with 3 separate initial conditions.
w_initial = [-1; .1; -.1]; %column vector containing initial values
[t, w] = ode45(@thefunc, t_duration, w_initial);
figure
plot3(w(:,1),w(:,2), w(:,3), '.');
grid on;
w_initial = [.4; -1; .2]; %column vector containing initial values
[t, w] = ode45(@thefunc, t_duration, w_initial);
figure
plot3(w(:,1),w(:,2), w(:,3), '.');
hold on;
w_initial = [-.5; 0; 0]; %column vector containing initial values
[t, w] = ode45(@thefunc, t_duration, w_initial);
figure
plot3(w(:,1),w(:,2), w(:,3), '.');
hold off;
grid on;

Respuestas (1)

Walter Roberson
Walter Roberson el 30 de En. de 2021
Remove the calls to figure
Move the call to "hold on" to after the first plot3() call
  2 comentarios
matlab_day
matlab_day el 30 de En. de 2021
Editada: matlab_day el 30 de En. de 2021
With the following code I still see only 1 curve as shown in the attached image.
w_initial = [-1; .1; -.1]; %column vector containing initial values
[t, w] = ode45(@thefunc, t_duration, w_initial);
figure
plot3(w(:,1),w(:,2), w(:,3), '.');
hold on;
w_initial = [-.5; 0; 0]; %column vector containing initial values
[t, w] = ode45(@thefunc, t_duration, w_initial);
figure
plot3(w(:,1),w(:,2), w(:,3), '.');
hold off;
Walter Roberson
Walter Roberson el 30 de En. de 2021
Remove all the calls to figure()

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by