Trying to code from polymath
显示 更早的评论
Im supposed to turn this Polymath code into a Matlab code but Im not sure how. Please help. Its supposed show a graph like in the example.

1 个评论
Walter Roberson
2022-5-29
What happened when you followed my suggestion to set up the equations using the Symbolic Toolbox and then use the sequence shown in the odeFunction() documentation ?
回答(1 个)
Walter Roberson
2022-5-28
0 个投票
I suggest that you set up the equations using the Symbolic Toolbox, and that you then use the flow of control shown in the first example for odeFunction() to convert into something that you can use with ode45()
1 个评论
Walter Roberson
2022-5-30
Use syms to declare all of the non-constants. On the syms command line, declare each of the functions in function form, such as
syms X(V) T(V) Ta(V)
Now assign all of the constants and non-differential equations as variables, including for example
deltaH = 80770+delCp*(T-298)
Now define variables corresponding to all of the derivatives, such as
dX = diff(X, V)
For future reference: if you had second derivatives, you would take the derivative of the derivative, such as
d2X = diff(dX, V)
Now create equations such as
eqn1 = dX == -ra/Fao
You will have three equations.
Also define equations for the initial conditions, such as
IC1 = X(0) == -1
IC2 = dX(0) == 2
Create a vector of differential equations, and one of initial conditions
eqn = [eqn1; eqn2; eqn3]
ICs = [IC1; IC2; IC3]
Now follow the work flow shown in the documentation for odeFunction().
The diagram you posted does not appear to have initial conditions for the equations, and unfortunately without initial conditions you are not going to be able to re-create the plots.
类别
在 帮助中心 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!