Hi, I have apparently run dsolve in such a way that I got an error in the solution, and now have to re-do the whole thing.
The problem I wanted to solve with dsolve is:
if true
% code
end
syms h r v(x)
h = 4.5
g = 4/pi
A = pi
expr = [h^2*(diff(v, 2)+2*i*h*diff(v) - g == 0)]
cond = v(0) == A*cos(x);
sol(x) = dsolve(expr,cond)
s = sol(x)
however I get the result:
Error using mupadengine/feval (line 166) Invalid equation or initial condition.
Error in dsolve>mupadDsolve (line 336) T = feval(symengine,'symobj::dsolve',sys,x,options);
Error in dsolve (line 194) sol = mupadDsolve(args, options);
Error in PDE_sol (line 11) sol(x) = dsolve(expr,cond)
any idea what went wrong?
Thanks!

댓글 수: 1

Sergio Manzetti
Sergio Manzetti 2017년 12월 8일
편집: Sergio Manzetti 2017년 12월 8일
PS: Trying another variant,
if true
% code
end
eqn = h.^2.*diff(y,t, 2) + g.*i.*diff(y, t)== a;
cond = y(0) == 5;
ySol(t) = dsolve(eqn,cond)
and it gives the strangest result:
C29 - (a*t*11150372599265311570767859136324180752990208i)/5959077882784213 + (124330809102446660538845562036705210025114037699336929360115994223289874253133343883264*a*h^2)/35510609213087978610768722029369 - exp(-(t*5959077882784213i)/(11150372599265311570767859136324180752990208*h^2))*((124330809102446660538845562036705210025114037699336929360115994223289874253133343883264*a*h^2)/35510609213087978610768722029369 + C29 - 5)
why is MATLAB making those horrible huge numbers? When I tried such simple eqns in the previous MATLAB I got simple results

댓글을 달려면 로그인하십시오.

 채택된 답변

Birdman
Birdman 2017년 12월 8일
편집: Birdman 2017년 12월 8일

1 개 추천

v(0) == A*cos(x)
You can not give a symbolic function(cos(x)) as an initial condition. You need something like
v(0)==0
You also need one more initial condition because you have second order differentiation in your equation. Otherwise you will see constants in your solution.
Try this:
syms h r v(x)
h = 4.5
g = 4/pi
A = pi
expr = [h^2*(diff(v, 2)+2*i*h*diff(v) - g == 0)];
Dv=diff(v);
cond = [v(0) == 0,Dv(0)==0];
sol = vpa(dsolve(expr,cond),4)

댓글 수: 10

Sergio Manzetti
Sergio Manzetti 2017년 12월 8일
Birdman, thanks. Of course, I was a little fast here...Cheers
Birdman
Birdman 2017년 12월 8일
You are welcome Sergio. If my answer helped, can you accept it?
Sergio Manzetti
Sergio Manzetti 2017년 12월 8일
Absolutely!
Sergio Manzetti
Sergio Manzetti 2017년 12월 8일
PS: What is 4 in :
sol = vpa(dsolve(expr,cond),4) ?
Sergio Manzetti
Sergio Manzetti 2017년 12월 8일
Birdman, the initial condition of being y_0= cos(x) is vital. It is allowed in PDEs, however I must eventually change the system to a PDE in case of using cos(x) as initial condition?
Birdman
Birdman 2017년 12월 8일
As far as I know, there is a function pdepe, that should do it for you.
But I assume you need cos(x) function's value at a certain point, right?
Birdman
Birdman 2017년 12월 8일
Btw, 4 is for displaying four digits after decimal.
Sergio Manzetti
Sergio Manzetti 2017년 12월 8일
THanks Birdman. All the best
A similar error using Dsolve here my friends,..
clear all
close all
syms u(t) v(t) f taux tauy Hm rho R u0 v0
du = diff(u);
dv = diff(v);
DE = [du - f*v == taux/(Hm*rho) - R*u; dv + f*u == tauy/(Hm*rho) - R*v]
Soln = dsolve(DE, u(0)==u0, v(0)==v0)
Error using mupadengine/feval (line 163)
The equations are invalid.
Error in dsolve>mupadDsolve (line 336)
T = feval(symengine,'symobj::dsolve',sys,x,options);
Error in dsolve (line 193)
sol = mupadDsolve(args, options);
I will appreciate any suggestion
Adarsh Narayan Pandey
Adarsh Narayan Pandey 2020년 11월 2일
Hey, did you find any solution to this error?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

질문:

2017년 12월 8일

댓글:

2020년 11월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by