solve systems of symbolic nonlinear ordinary differential equations with replace the equations by parameters

7 views (last 30 days)
Hi
I have systems of symbolic nonlinear ordinary differential equations. Since my equations are too long, I have to save them in parameters and use these parameters in my differential equations. dsolve can't solve these equations. How can I solve these systems?
A simple example of my work is:
syms dq1 q2 t
dq1 = sym('dq1(t)');
q2 = sym('q2(t)');
l=[dq1+cos(q2),5*cos(q2)+3*dq1];
s=dsolve(['Ddq1= ' char(l(1,1))],['Dq2= ' char(l(1,2))],'q2(0)=0,dq1(0)=0');

Answers (2)

Walter Roberson
Walter Roberson on 3 May 2012
I am not sure why you need to use char() instead of subs() ?
l1 = l(1); l2 = l(2);
s = dsolve(subs(sym('Dq1=l1')), subs(sym('Dq2=l2')), sym('q2(0)'), sym('dq1(0)'));
  6 Comments
Saurabh Das
Saurabh Das on 23 May 2020
Hi Walter,
Nice to see that were following comments on the post after seven years!
I have been trying to solve a nonlinear differential equation symbolically. The below code is what I have been trying to execute. But, the final answer does not has 's' in it besides being a piecewise solution. It would be greatly appreciated if you could show me a way forward on this.
clear all
clc
syms u(s) s C n h t_c
Du = diff(u,s);
eqn = diff(u,s,3) == [(C/h)^2]*diff(u,s,1)*[(u/t_c)^(n-1)]*n;
cond1 = u(0) == 0;
cond2 = Du(0) == 0;
conds = [cond1, cond2];
sol(s) = dsolve(eqn,conds)
Walter Roberson
Walter Roberson on 24 May 2020
Edited: Walter Roberson on 1 Dec 2020
Mathematica cannot seem to get anywhere with this.
Maple can find a not-very-useful form for the main equation, but as soon as the first boundary condition is put in, it complains about division by 0.
I do not think you are going to be able to find a useful symbolic solution to this.

Sign in to comment.


Kerem Bikmaz
Kerem Bikmaz on 1 Dec 2020
Hello guys. I have a similar quesiton just Frank asked. I need to use dsolve equation in my question but ı dont know how can ı do. Maybe you guys can help me to figure it out.
Consider the electrical circuit shown in figure with the values of inductance,
resistance, and capacitance set to L = 1/12 H, R = 7/12 W, and C = 1 F
The circuit is assumed to be open before t = 0, i.e. no current is initially flowing through the circuit (w’(0) = 0) . However, the capacitor has an initial charge of 5 V (w(0)=5).
Determine
a.
(i) the zero-input response wzi(t) of the system;
(ii) the zero-state response wzs(t) of the system; and
(iii) the overall response w(t),
b. Use matlab symbolic toolbox dsolve function to solve i,ii and iii.
when the input signal is given by x(t)=2e−tu(t)and the output w(t) is measured across capacitor C.

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!