필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Can someone help me with my code ? I can not see error.

조회 수: 1 (최근 30일)
Kamuran
Kamuran 2014년 11월 2일
마감: MATLAB Answer Bot 2021년 8월 20일
function dy = vdp1000(t,y)
dy = zeros(2,1);
dy(1) = y(2);
dy(2) = 1000*(1 - y(1)^2)*y(2) - y(1);
[T,Y] = ode15s(@vdp1000,[0 3000],[2 0]);
plot(T,Y(:,1),'-o')
  댓글 수: 1
Harry
Harry 2014년 11월 2일
편집: Harry 2014년 11월 2일
The code runs fine for me. (I called the function with input 'y' as 1:2). The input variable 't' is never used, so you can delete that.

답변 (1개)

Peng Liu
Peng Liu 2014년 11월 2일
There is nothing wrong with your code. You just need to save the function vdp1000 as an independent m file with name vdp1000.m and add it to the MATLAB current folder. Then you should be able to run: [T,Y] = ode15s(@vdp1000,[0 3000],[2 0]); plot(T,Y(:,1),'-o')

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by