Solving system of differential equation using DSolve - Not getting simplified equation
Afficher commentaires plus anciens
Trying to solve the system of linear equations using DSolve. I am getting the solution as an integral. I want the integral to solved so that I can evaluate numerically. Can someone please help
Réponses (1)
Shivam Malviya
le 18 Mai 2023
Hi,
I understand that you are interested in finding the solution of the linear equations system using “dsolve”. However, your solution contains an integral that does not allow you to calculate the numerical value of the function.
The reason is that the integral is nonelementary, which means it cannot be simplified further using elementary functions. To get the numerical value, you can follow these steps:
- Declare "C1" as a symbolic variable.
% Declare C1 as symbolic
syms C1
- Replace the symbolic constants with their actual values.
% Replace the symbolic constants with their respective value
expr = subs(simplifiedExpr,[a0,a1,a2,a3,a4,m,C1,Q_in,Q_out],[1,2,3,4,5,6,7,8,9]);
- Use the “matlabFunction” to convert the output expression into a function handle. This will change the indefinite integral into a definite integral with 0 as the lower bound and “t” as the upper bound.
% Convert the expr into function handle
f = matlabFunction(expr)
- Evaluate the function for any specific value of “t”.
% Get the value of f for any specific value of t
disp(f(0.1))
Please find the attached script for your reference.
Refer to the following links for a better understanding;
- https://in.mathworks.com/help/symbolic/dsolve.html
- https://in.mathworks.com/help/symbolic/subs.html
- https://in.mathworks.com/help/symbolic/sym.matlabfunction.html
Regards,
Shivam
2 commentaires
Jayesh Jawandhia
le 18 Mai 2023
Shivam Malviya
le 19 Mai 2023
Hi Jayesh,
A differential equation's general solution accommodates one or more unspecified constants that can be evaluated through initial or boundary conditions. To obtain the value of constant C1, apply the boundary conditions accordingly.
If you find this answer helpful, please mark it as accepted so others can benefit from it too.
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!