Solve ODE with odee45
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi all, I hope everyone is doing well and safe!
I have 4 differntionl equtions and I need to solve them in ode45, I tried to do it in different ways but no luck! the four equtions:
dy(1) = vas-y(2)+0.15*(0.049*((y(1)/0.1)+y(3)/0.1)-y(1));
dy(2) = y(1)+0.15*(0.049*((y(2)/0.1)+y(4)/0.1)-y(2));
dy(3) = 0-0.49*y(4)+0.15*(0.049*((y(1)/0.1)+y(3)/0.1)-y(3));
dy(4) = 0-0.49*y(3)+0.15*(0.049*((y(2)/0.1)+y(4)/0.1)-y(4));
I need to plot them as well. Any help will be appreciated.
댓글 수: 0
채택된 답변
madhan ravi
2020년 5월 23일
편집: madhan ravi
2020년 5월 23일
ic=randi([0,1],4,1)
ode45(@(t,y)myfunc(t,y,5),[0,10],ic)
function dy = myfunc(t,y,vas)
dy=zeros(4,1);
dy(1) = vas-y(2)+0.15*(0.049*((y(1)/0.1)+y(3)/0.1)-y(1));
dy(2) = y(1)+0.15*(0.049*((y(2)/0.1)+y(4)/0.1)-y(2));
dy(3) = 0-0.49*y(4)+0.15*(0.049*((y(1)/0.1)+y(3)/0.1)-y(3));
dy(4) = 0-0.49*y(3)+0.15*(0.049*((y(2)/0.1)+y(4)/0.1)-y(4));
end
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!