MATLAB Answers

Get differential equation of derivative

72 views (last 30 days)
John F
John F on 20 Dec 2020
Answered: Manas Meena on 7 Jan 2021
I have a differential equation that looks like this:
dT/dx = (1+alpha*M1)*(T^2)*S(x) - 4*(2+gamma*M2)*x*T
I want to differentiate this equation let's say over **alpha**. However, T depends on **alpha**. How can I get a differential equation that *includes* the derivative **dT/da** so I can solve for it (using ode45 or something)?
**Note:** I can't differentiate the equation by hand as I will need to do this for the Ys as well, where I don't have an easy analytical function.
My code so far:
syms L alpha gamma Y2 Y3 Y4 Y5 Y6 x T X
M1 = 0;
M2 = 7;
Y1 = 1 + M2 / 10;
Y7 = 3 + M1 / 10;
xcp = [0 0.1*L 0.25*L 0.5*L 0.6*L 0.75*L L];
ycp = [Y1 Y2 Y3 Y4 Y5 Y6 Y7];
T0 = 5 + 1/L - 25/(L^2);
S = bezier_syms(); % Assume this returns a function of L,x,Y2,Y3,Y4,Y5,Y6
ode = diff(T,x) == (1+alphaM1)*(T^2)*S(L,x,Y2,Y3,Y4,Y5,Y6) - 4*(2 + gamma*M2)xT;


Sign in to comment.

Answers (1)

Manas Meena
Manas Meena on 7 Jan 2021
You can try and use the Symbolic Math Toolbox function odeFunction to convert the odes variable into a function handle. After that you will have to construct a numeric vector of initial conditions y0 and figure out the time span.
[t,y] = ode45(@odesNew,[t0 tfinal],y0)
refer to the link below for the function documentation


Sign in to comment.




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!