Something is going wrong. Here is the code i'm trying to get to work
%function dLdt = Lorentz(t,x,y,z)
%s = 10
%b = 8/3
%x = L(1);
%y = L(2);
%z = L(3);
%dx = s*(y - x)
%dy = r*x - y - x*z
%dz = x*y - b*z
%dLdt = zeros(3,2,1);
%dLdt(1)=dx;
%dLdt(2)=dy;
%dLdt(3)=dz;
That is the one .m file i made. The second one is simply
%[t,x,y,z]=ode45('pro1',0:0.001:1,[1 1 1]);
%plot3(L(:,1),L(:,2),L(:,3));
Now it says 'Undefined function or method 'L' for input arguments of type 'double'. I'm pretty sure my syntax is completely retarded somewhere. This is why i'm asking you guys :)
pro1 is the .m file

답변 (2개)

Image Analyst
Image Analyst 2014년 5월 18일

0 개 추천

Why do you think L should have any value? Did L come from anywhere? No. It was not passed in through the input argument list, nor is it a global variable, nor did you call getappdata() or assign it or initialize it. So how is L supposed to have any value?

댓글 수: 3

Andrew Davies
Andrew Davies 2014년 5월 18일
Well, can you tell me how i should define x y and z then? they're supposed to have initial values (mine were [1 1 1]) and the i'm using ode45 to solve the equations i described
Image Analyst
Image Analyst 2014년 5월 19일
Attach pro1.m so we can try to fix it.
Andrew Davies
Andrew Davies 2014년 5월 19일
pro1.m is the first section of code i wrote up

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

Marc
Marc 2014년 5월 18일

0 개 추천

I think you want to define your function Lorentz(t,L).
Also, in your call to Ode45, I think you want to indicate Lorentz as the function and instead of x,y,z in the output, replace with L.

댓글 수: 1

Andrew Davies
Andrew Davies 2014년 5월 19일
So now it's saying there aren't enough input arguments

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

카테고리

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

태그

질문:

2014년 5월 18일

댓글:

2014년 5월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by