Plotting more than one graph onto a 3d plot

조회 수: 6 (최근 30일)
matlab_day
matlab_day 2021년 1월 30일
댓글: Walter Roberson 2021년 1월 30일
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;

답변 (1개)

Walter Roberson
Walter Roberson 2021년 1월 30일
Remove the calls to figure
Move the call to "hold on" to after the first plot3() call
  댓글 수: 2
matlab_day
matlab_day 2021년 1월 30일
편집: matlab_day 2021년 1월 30일
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 2021년 1월 30일
Remove all the calls to figure()

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by