Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Hi,
I have a new problem. I want to solve a ODE-system with variable parameter. In the picture you see a minimal example.
I want solve the ODE with variable a so that i get 5 different solutions of the ODE-system. Is there a solution without to use a program? AN if I need a program, how looks it.
thanks for helping!
Solved! Go to Solution.
Hi Fabian G.
Could we know what's the differential equation or is it top secret?
Why do you think its a secret?
We see the function f and the vector D, So we know which ODE system is to be solved.
Fabian already wrote that its just a very simple minimal system for demonstration purpose and the goal is not to solve THIS system, I guess, but rather find a way ro make the solution dependent from a parameter a.
... evidently I missed something ...
F.M. wrote:
... evidently I missed something ...
no problem
I fear you can't use a range variable for a and plot all resulting functions, but you sure can make the result of Radau dependent of a variable argument a.
Here is a way to do it (I changed the system a little bit to make it more interesting :):
Hey Werner Exinger
first, thanks for the help. Your solution works, but now i have a problem with units. I try to model a chemical kinetic. Here i give a simply form of it.
It is a first order reaction combined with the arrhenius combination to find a solution for the reaction temperatur X_1 and mol X_0. THerefore i solve a material balance and energy balance. With the fuction U(t,X) i want to simulate a cooling failure. That means at a specific time point a, the cooling is stopping (With Cooling U(t,X)=5, with cooling failure U(t,X)=0).
without units it works fine: (i choose some random number to see something) So know i have a cooling failure after 150 and 400.
with units i get this
Hi
there must be an inconsistency in the measurement unit:
assuming that there are 5000m ^ 2, we get:
See a picture:
Thanks that was the problem. It is great how fast and good the help in this community is.
Thanks for this comment Fabian!
As the Community Manager, this makes my day - as you have seen there is a wealth of knowledge within.
Thank you Fred Kohlhepp Werner Exinger Francesco Mezzanino Viktor Korobov
Best,
Toby
> Your solution works,
I seems to me that you are using the solution of Fred, who answered first. But mine is quite similar.
Additionally to what FM and Viktor had said it looks like the arguments of your function Ans() should not be unitless but be of dimension time because in U() you compare them with t, which has dimension time.
Furthermore, while I guess its not mandatory, to be on the safe side and for consistency, the "0" in your if-command of function U should get explicitly the same units as U.
And then I think its not a good idea to use the same name U for the constant and the local function U, which uses the constant U.
Note, that FM had dealt with all of the above said in his second picture.
I am still not sure why FM's second pic is not showing the same as your unitless approach. The minus sign which Viktor had pointed you to is missing in both, so the output should be similar.
As I am Prime-less at the moment I can only judge from the pics, so maybe I am missing something.
EDIT: Ah, I guess the difference is because of the 50° C. If you use 50 K instead (or 323.15 instead of 50 in your unitless variant) I guess you will get a similar result. Can't check it though.
If you really need to plot all functions for a set of given parameters with just one command (and in all the same color) you can call the function DGL from my last post with a vector (not a range) as argument and use small routine to separate the various result vectors and create a suitable data structure: