Parallel ODE solve using parfor-loop
Show older comments
Hello, I'm trying to solve my parallel ODE system, because very a small step and high tolerance are necessary here. Here is the code:
n = 4
matlabpool('open',n)
X0=[0.0046 10.9820 15.3579]
tend=5000;
parfor i=0:100
options = odeset('RelTol', 1e-2,'MaxStep', 1e-4);
[T(i*50:(i+1)*50),X(i*50:(i+1)*50)] = ode45(@rightpart,[50*i 50*(i+1)],X0,options);
end
matlabool close;
figure
plot(T,X(:,1),'-',T,X(:,2),'-.',T,X(:,3),'.')
figure
plot3(X(:,1),X(:,2),X(:,3))
end
Matlab doesn't allow to use [T,X] after parfor-loop. How can I modify this code? Or are there any other solutions for this problem?
Accepted Answer
More Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!