필터 지우기
필터 지우기

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

조회 수: 7 (최근 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에서 Equation Solving에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by