Question

I have this function in Matlab:

function uprime=G(t,u,a,b,r)
uprime=zeros(3,1);
uprime(1)=-a*u(1)+a*u(2);
uprime(2)=r*u(1)-u(2)-u(1)*u(3);
uprime(3)=-b*u(3)+u(1)*u(2);

Then this script:

close all
tspan=[0,100];
[t,u]=ode45(@G,tspan,init,[],a,b,r);
comet3(u(:,1),u(:,2),u(:,3))

What I'd like to do is set the view to

view(-4,8)

before the comet3 plot begins. Any suggestions?

No correct solution

OTHER TIPS

You can use hold to lock the axes:

...
view(-4,8);
hold on
comet3(u(:,1),u(:,2),u(:,3));
hold off

If you want to be more specific, you can just hold the current axis (gca) or a handle to particular axis that you plotting to:

...
view(-4,8);
hold(gca,'on');
comet3(gca,u(:,1),u(:,2),u(:,3));
hold(gca,'off');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top