Matlab take a long time for evaluation

1 次查看(过去 30 天)
Wajahat
Wajahat 2018-10-9
评论: Jan 2018-10-9
When I evaluate the program (given below), matlab take a long time to evaluate this program. How to get rid off from this problem?
syms x
D=0.1;
k1=-0.5; c1=1; a=1; b=2;
C=1+c1*exp(k1*x);
u0=diff(log(C),x);
u0=inline(u0);
x=[-50:D:50];
u0=u0(x);
options=odeset('RelTol',1e-4,'AbsTol',1e-8);
[t u]=ode45(@dydt, [0:D^3:40], u0, options);
T=t;
X=[-50:D:50];
[t,x]=meshgrid(T,X);
u=u';
t=t(:,1:8000:40001);
x=x(:,1:8000:40001);
U=u(:,1:8000:40001);
plot3(x,t,U,'.')
axis([-50 50 0 40 -0.5 0])
  1 个评论
Jan
Jan 2018-10-9
What does "a long time" mean exactly? Too many seconds or weeks? You did not post the code for |dydt|. Did you check if the ODE is stiff? Then ODE45 is a bad choice. The absolute tolerance of 1e-8 might be too small for an efficient integration. BY the way, see <http: how to format code in the forum>. There is no need for square brackets around vectors, this is sufficient already: |X=-50:D:50;|. </http:>

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by