Matlab take a long time for evaluation

조회 수: 2 (최근 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에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by