ode45 Initial conditions are not at the same point
3 次查看(过去 30 天)
显示 更早的评论
Hello everybody, I'm using ode45 to solve some easy differential equations.
Here are the equations that I have:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/196489/image.png)
For now, I have the initial conditions:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/196491/image.png)
As you can see, the initial conditions are in not the common case, which may look like:x(4)=a;y(4)=b;
The value of x and y gets from different point.
Any suggestion on the set of initial values for ode45?
Thank you in advance!
Meredith
0 个评论
采纳的回答
madhan ravi
2018-11-24
5 个评论
madhan ravi
2018-11-28
Anytime :) if you find the answer helpful and it answered your query make sure to accept the answer
更多回答(1 个)
Pasindu Ranasinghe
2021-7-22
Example Code
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/692824/image.png)
Use ode45() to find the approximate values of the solution at t in the range of 1 to 3
function ydot = eqns(t,y)
ydot=(t-exp(-t))/(y+exp(y));
end
###################################
%%Code
[t1,y1]=ode45(@eqns,[1.5 1], 0.5);
hold on;
[t2,y2]=ode45(@eqns,[1.5 3], 0.5);
hold off
t=[t1;t2];
y=[y1;y2];
plot(t,y,'-o')
HOPE YOU FIND THIS USEFULL
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!