Parallel ODE solve using parfor-loop
显示 更早的评论
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?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!