Solving system of differential equation using DSolve - Not getting simplified equation

4 次查看(过去 30 天)
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

回答(1 个)

Shivam Malviya
Shivam Malviya 2023-5-18
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;
Regards,
Shivam
  2 个评论
Jayesh Jawandhia
Jayesh Jawandhia 2023-5-18
Hey Shivam, thank you so much for this. Just a follow-up. How can I make MATLAB help me find the value of C1 since it's an integration constant? I have the experimental values V_cga and I would want to find the best fit value for C1 which has the least error.
Shivam Malviya
Shivam Malviya 2023-5-19
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by