Help please, I cant use Dsolve and dont understand why :(

Hi,
I really need help with this error please. I do not know what is causing it, in my opinion I have 4 variables and 4 equations, it should work fine.
Thanks in advance.

2 Comments

Paul
Paul on 12 Oct 2021
Edited: Paul on 12 Oct 2021
ode3 and ode4 aren't differential equations. Are you intending that ode3 and ode4 should subsitute into ode2?
I thought that dsolve worked for differential and algebraic equations. Do I always need to separate the equationsto solve them. Dsolve for differential and subs for algebraic?

Sign in to comment.

 Accepted Answer

syms o_r(r) o_t(r) e_r(r) e_t(r)
e_t = o_t - o_r
e_t(r) = 
e_r = o_r - o_t
e_r(r) = 
ode1 = diff(o_r.*r) == o_t
ode1(r) = 
ode2 = diff(e_t.*r) == e_r
ode2(r) = 
temp1 = ode1(r) - o_r(r)
temp1 = 
ode1b = lhs(temp1)/r == rhs(temp1)/r
ode1b = 
temp2 = simplify(subs(ode2, lhs(ode1b), rhs(ode1b)))
temp2(r) = 
ode2b = simplify((temp2(r) - o_t(r))/r)
ode2b = 
odes = [ode1b; ode2b]
odes = 
sol = dsolve(odes)
sol = struct with fields:
o_t: C1/2 - C2/r^2 o_r: C1/2 + C2/r^2

4 Comments

I tried to do it like this with your feedbacks, but it can not solve the eqn system.
If I got it right, what you are doing is separating the diff() on one side and replacing it later, in a way you are helping Matlab to solve the problem. Is there no Matlab comand that can solve it automatically?
clc
E=210000;
v=0.4;
syms o_r(r) o_t(r) e_r(r) e_t(r )
eqn1 = e_t == (o_t - v.*o_r)./E
eqn1(r) = 
eqn2 = e_r == (o_r - v.*o_t)./E
eqn2(r) = 
ode1 = diff(o_r*r) == o_t
ode1(r) = 
ode2 = diff(e_t*r) == e_r
ode2(r) = 
ode2b= simplify(subs(ode2,[lhs(eqn1),lhs(eqn2)],[rhs(eqn1),rhs(eqn2)]))
ode2b(r) = 
odes = [ode1; ode2b]
odes(r) = 
sol = dsolve(odes)
Warning: Unable to find symbolic solution.
sol = [ empty sym ]
Is there no Matlab comand that can solve it automatically?
NO
E=210000;
v=0.4;
syms o_r(r) o_t(r) e_r(r) e_t(r )
eqn1 = e_t == (o_t - v.*o_r)./E
eqn1(r) = 
eqn2 = e_r == (o_r - v.*o_t)./E
eqn2(r) = 
ode1 = diff(o_r*r) == o_t
ode1(r) = 
ode1b = (ode1 - o_r)/r
ode1b(r) = 
ode2 = diff(e_t*r) == e_r
ode2(r) = 
ode2b = (ode2 - e_t)/r
ode2b(r) = 
odes = [ode1b; ode2b]
odes(r) = 
sol = dsolve(odes)
sol = struct with fields:
e_t: C2/r + int(e_r(r), r, 'IgnoreSpecialCases', true, 'IgnoreAnalyticConstraints', true)/r o_r: C1/r + int(o_t(r), r, 'IgnoreSpecialCases', true, 'IgnoreAnalyticConstraints', true)/r
You cannot resolve more than this without additional information that allows e_r and o_t to be defined.

Sign in to comment.

More Answers (0)

Products

Release

R2021b

Community Treasure Hunt

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

Start Hunting!