how can i solve the error in this code?

Hello.
i have try many time to solve this code but it still get error at [t,xa]=ode45(MaranV,[0 210],[0.9,0.9,0.9,0.9],options). I need someone to check this...
thank you.
%Programs - b - Lorenz system
clear
MaranV=inline('(-1/3)*((13/(300*(8/3)))-9)*x(1)+(1/3)(11+(3/(300*(8/3))))*x(4)+(4/(3*(8/3)));(1/10)*((1/4)*x(1)+(3/4)*x(4)-(13/2)*x(2)-x(1)*x(3)-3*x(4)*x(3));(1/10)*((-45/2)*x(3)+x(1)*x(2)+3*x(4)*x(2));6*((-1/3)*((13/(300*(8/3)))-9)*x(1)+(1/3)*(11+(3/(300*(8/3))))*x(4)+(4/(3*(8/3)))*x(2))-9*x(4)','t','x');
options = odeset('RelTol',1e-4,'AbsTol',1e-4);
[t,xa]=ode45(MaranV,[0 210],[0.9,0.9,0.9,0.9],options);
subplot(2,2,1)
plot3(xa(:,1),xa(:,2),xa(:,3),'.','MarkerSize',1)
xlabel ('X')
ylabel ('Y')
zlabel ('Z')
%axis([.7 .9 1.5 1.7 .8 1])
title(['(a) r=300'])
grid on
axis ij
axis square
%set(gcf,'PaperPosition',[2 2 4 4])
%set(gca,'PlotBoxAspectRatio',auto)
%-------------------------------------------------------------
MaranV=inline('[(-1/3)*((13/(360*(8/3)))-9)*x(1)+(1/3)(11+(3/(360*(8/3))))*x(4)+(4/(3*(8/3)));(1/10)*((1/4)*x(1)+(3/4)*x(4)-(13/2)*x(2)-x(1)*x(3)-3*x(4)*x(3));(1/10)*((-45/2)*x(3)+x(1)*x(2)+3*x(4)*x(2));6*((-1/3)*((13/(360*(8/3)))-9)*x(1)+(1/3)*(11+(3/(360*(8/3))))*x(4)+(4/(3*(8/3)))*x(2))-9*x(4)]','t','x');
options = odeset('RelTol',1e-4,'AbsTol',1e-4);
[t,xa]=ode45(MaranV,[0 210],[0.9,0.9,0.9,0.9],options);
subplot(2,2,2)
%figure(1)
plot3(xa(:,1),xa(:,2),xa(:,3),'.','MarkerSize',1)
xlabel ('X')
ylabel ('Y')
zlabel ('Z')
%axis([.7 .9 1.5 1.7 .8 1])
title(['(b) r=360'])
grid on
axis ij
axis square
%set(gcf,'PaperPosition',[2 2 4 4])
%set(gca,'PlotBoxAspectRatio',auto)
%----------------------------------------------------------------
MaranV=inline('(-1/3)*((13/(400*(8/3)))-9)*x(1)+(1/3)(11+(3/(400*(8/3))))*x(4)+(4/(3*(8/3)));(1/10)*((1/4)*x(1)+(3/4)*x(4)-(13/2)*x(2)-x(1)*x(3)-3*x(4)*x(3));(1/10)*((-45/2)*x(3)+x(1)*x(2)+3*x(4)*x(2));6*((-1/3)*((13/(400*(8/3)))-9)*x(1)+(1/3)*(11+(3/(400*(8/3))))*x(4)+(4/(3*(8/3)))*x(2))-9*x(4)','t','x');
options = odeset('RelTol',1e-4,'AbsTol',1e-4);
[t,xa]=ode45(MaranV,[0 210],[0.9,0.9,0.9,0.9],options);
subplot(2,2,3)
%figure(1)
plot3(xa(:,1),xa(:,2),xa(:,3),'.','MarkerSize',1)
xlabel ('X')
ylabel ('Y')
zlabel ('Z')
%axis([.7 .9 1.5 1.7 .8 1])
title(['(c) r=400'])
grid on
axis ij
axis square
%set(gcf,'PaperPosition',[2 2 4 4])
%set(gca,'PlotBoxAspectRatio',auto)
%-----------------------------------------------------
MaranV=inline('(-1/3)*((13/(500*(8/3)))-9)*x(1)+(1/3)(11+(3/(500*(8/3))))*x(4)+(4/(3*(8/3)));(1/10)*((1/4)*x(1)+(3/4)*x(4)-(13/2)*x(2)-x(1)*x(3)-3*x(4)*x(3));(1/10)*((-45/2)*x(3)+x(1)*x(2)+3*x(4)*x(2));6*((-1/3)*((13/(500*(8/3)))-9)*x(1)+(1/3)*(11+(3/(500*(8/3))))*x(4)+(4/(3*(8/3)))*x(2))-9*x(4)','t','x');
options = odeset('RelTol',1e-4,'AbsTol',1e-4);
[t,xa]=ode45(MaranV,[0 210],[0.9,0.9,0.9,0.9],options);
subplot(2,2,4)
%figure(1)
plot3(xa(:,1),xa(:,2),xa(:,3),'.','MarkerSize',1)
xlabel ('X')
ylabel ('Y')
zlabel ('Z')
%axis([.7 .9 1.5 1.7 .8 1])
title(['(d) r=500'])
grid on
axis ij
axis square
%set(gcf,'PaperPosition',[2 2 4 4])
%set(gca,'PlotBoxAspectRatio',auto)
hold off

댓글 수: 5

John Doe
John Doe 2013년 5월 21일
I would recommend you to:
1. Format your code.
2. Don't tag individuals, as it discourages others from answering your question.
Jan
Jan 2013년 5월 21일
And please post the error message. It is hard to debug, when the error is unknown.
che ku norsyazwani
che ku norsyazwani 2013년 5월 22일
편집: che ku norsyazwani 2013년 5월 22일
To Robert P. 1. Format means that I should change all the code according to the latest version. it is like that? 2. I am sorry for that. Thank you for your responns. Smile.
che ku norsyazwani
che ku norsyazwani 2013년 5월 22일
To Jan Simon, this is the error that appeared after i corrected multiplication character in "(1/3)(11+"
Error in ==> inline.feval at 36 INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);
Error in ==> odearguments at 110 f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ==> ode45 at 173 [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in ==> MarVar at 5 [t,xa]=ode45(MaranV,[0 210],[0.9,0.9,0.9,0.9],options);
Thank for your respons. Smile
Jan
Jan 2013년 5월 22일
Are you sure, that this is the complete message? We see, where the problem occurres, but no hint about the nature of the problem. This is very unusual for Matlab.

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2013년 5월 21일

0 개 추천

You are missing a multiplication character in "(1/3)(11+"

댓글 수: 1

che ku norsyazwani
che ku norsyazwani 2013년 5월 22일
But it still appear this error. what's means? i am not very understand about this error.
Error in ==> inline.feval at 36 INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);
Error in ==> odearguments at 110 f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ==> ode45 at 173 [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...
Error in ==> MarVar at 5 [t,xa]=ode45(MaranV,[0 210],[0.9,0.9,0.9,0.9],options);
Thank for your respons. Smile

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jan
Jan 2013년 5월 22일

0 개 추천

Using inline objects have the strong disadvantage, that it is impossible to use the debugger to find bugs. Therefore I suggest to avoid them and write such large formulas to M-functions instead, where the debugger and the MLint code checker can reveal problems much easier.
Expresions like "(-1/3)*((13/(500*(8/3)))-9)" are extremely ugly. On one hand I have to waste time with counting, if the trailing parenthesis belongs to the leading one or not. And on the other hand calculating such expressions in each function evaluation wastes a lot of time. Performing this once and using a single numerical value directly would be nicer, faster and less confusing, when you have to debug the code.

카테고리

도움말 센터File Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by