Using ODE's in space and time
显示 更早的评论
Hi,
I made a bit of a time investment to get a system of equations into an ODE format in a seperate function file. These equations are dependent on time, but I wish to define a 1D geometry. say X=0:dx:10. I created the function file so that for every time point I solve all of my X's. In my X domain I give a step for a defined time perios over a defined distance and then leave it to work itself out. The problem I am running into now is that MatLab is wanting the output to be a column vector. Currently I have it set up such that I get a 2D matrix out. Each row is a differential equation and each column is a specific place in space. This is not an acceptable output for an ODE solver it seems.
I previously went around this problem before by setting up a Euler integration approach but I am running into the limits of MatLab memory constraints and need the variable step sizes that an ODE solver gives me. I have also looked into PDEPE and am not sure that this is the solution. I am still trying to see all of the option in the toolbox but I could use a helping hand.
Thanks,
Ryne
回答(1 个)
Torsten
2015-1-29
0 个投票
Use reshape to transform your 2d-matrix to a column vector:
reshape(A,[neq*nx,1])
where neq is the number of differential equations and nx is the number of grid points in x direction.
Best wishes
Torsten.
3 个评论
Michael Horn
2015-1-29
Michael Horn
2015-1-29
Torsten
2015-1-30
Don't care about what the integrator does in the background.
You have to take care that you supply correct initial conditions and time derivatives for the variables.
The replacement of the 2D data to an 1D column has no effect on how the solver tackles your problem.
Best wishes
Torsten.
类别
在 帮助中心 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!