Using ODE's in space and time
4 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Torsten
on 29 Jan 2015
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 Comments
Torsten
on 30 Jan 2015
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.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!