How to graph a differential equation

조회 수: 2 (최근 30일)
Krish Desai
Krish Desai 2016년 2월 12일
편집: Daniel Baughman 2018년 2월 8일
The equation I am trying to graph: f(y)=r(1−(y/L)y - py^2/(q+y^2)
Where p=1.2, q=1 and L=6.1
function yp=fishfun(t,y)
[t,y]=fishfun(fishfun,[0,1],-1);
plot(t,y)
yp=0.65*(1-(y/6.1))*y-(1.2*y*y)/1+y*y;
odeplot(t,y)

채택된 답변

Star Strider
Star Strider 2016년 2월 13일
I believe this is what you want to do:
fishfun = @(t,y) 0.65*(1-(y/6.1))*y-(1.2*y*y)/1+y*y;
[t,y]=ode45(fishfun,[0,1],-1);
figure(1)
plot(t,y)
grid
  댓글 수: 1
Daniel Baughman
Daniel Baughman 2018년 2월 8일
편집: Daniel Baughman 2018년 2월 8일
I don't understand why I have to use ode45 to plot differential equations. Edit: sorry just seems more complicated than it has to be.

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

추가 답변 (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