Solving a PDE symbolically

Greetings! Background: I'm studying "Interconnection and damping assignmemnt passivity based control" (abbreviated as "IDA-PBC"). The general challenge is to solve the matching equations. I am using symbollic math to enter systems of differential equations.
Example: I have a system of differential equations with two state variables like so (this is only an example from my head, just to illustrate what I'm trying to do):
x1_prime = x2 + u*x1 + dH/dx1 <--- dH/dx1 is the partial deriv of H wrt x1
x2_prime = x1 + dH/dx2 <--- dH/dx2 is the partial deriv of H wrt x2
H is the energy function that I'm trying to find
--> I know the partial derivatives of the function H, but I don't know what H itself is. Is there a matlab function that will help me find H symbollically?

 Accepted Answer

Torsten
Torsten on 18 Oct 2022
Edited: Torsten on 18 Oct 2022
First check whether (dH/dx1,dH/dx2) is conservative.
Then you can reconstruct H by using
H(x1,x2) = H(x10,x20) + integral_{z=x10}^{z=x1} dH/dx1(z,x20) dz + integral_{z=x20}^{z=x2} dH/dx2(x1,z) dz
where H(x10,x20) must be given (thus H must be fixed at a single point).
Following the example under
syms x y x1 y1
dHdx = y*cos(x) + y^2;
dHdy = sin(x)+2*x*y-2*y;
x0 = 0;
y0 = 0;
H0 = 0;
H = H0 + int(subs(dHdx,y,y0),x,x0,x1) + int(subs(dHdy,x,x1),y,y0,y1);
H = subs(H,[x1,y1],[x,y])
H = 

3 Comments

Thank you for your help Torsten! I have a confession to make. I should have stated this in my initial post (please forgive my mistake):
H is a scalar function, not a vector field. Typically, it represents the energy of the system of differential equations (such as an R-L-C circuit, where L is the inductance [one stte variable], and C is the capacitance [the other state variable]).
That is:
==> H(x1, x2) = "something I have to find"
==> I know the partial derivs of H(x1, x2), which give me the gradient of the energy function.
[dH/dx1,dH/dx2] is the vector field of H.
Read my answer more carefully.
Thank you again Torsten - my previous response shows just how much I need to learn!
--> I certainly APPRECIATE your example code that you gave!

Sign in to comment.

More Answers (0)

Products

Release

R2021b

Tags

Asked:

on 18 Oct 2022

Commented:

on 19 Oct 2022

Community Treasure Hunt

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

Start Hunting!