Why is ySol(t) = Dsolve(ode,cond) wrong? What should it be instead?

11 ビュー (過去 30 日間)
Yasmine Abdu
Yasmine Abdu 2022 年 1 月 1 日
コメント済み: Yasmine Abdu 2022 年 1 月 1 日
I solved the ODE by subsituting the the data in 'C' (numerous values) and i got a series of around 10 ODE eqs that look like this (heres one as an example):
ode(t) = diff(y(t), t)= 83136/832 - (100*y(t))/5
I want to solve for y(t) for all 10 eqs so i tried
ySol(t) = dsolve(ode,cond)
with the cond being
cond = y(0) == C
where C is workspace of 10 know values which i used to solve for the ode
this is the wrong part which i cant right
ySol(t) = dsolve(ode,cond)
any ideas on how i can solve the 10 odes for y(t)??
Warning: Number of equations greater than number of indeterminates. Trying heuristics to reduce
to square system.
> In symengine
In mupadengine/evalin_internal
In mupadengine/feval_internal
In dsolve>mupadDsolve (line 334)
In dsolve (line 203)
Error using mupadengine/feval_internal
Unable to reduce to square system because the number of equations differs from the number of
Error in dsolve>mupadDsolve (line 334)
T = feval_internal(symengine,'symobj::dsolve',sys,x,options);
Error in dsolve (line 203)
sol = mupadDsolve(args, options);

回答 (2 件)

Torsten 2022 年 1 月 1 日
syms Cs t y(t)
ode = diff(y,t) == 40*Cs-40/280*y;
cond = y(0) == Cs;
ySol(t) = dsolve(ode,cond);
ysol_num = subst(ySol,Cs,C)
  3 件のコメント
Yasmine Abdu
Yasmine Abdu 2022 年 1 月 1 日
Ahhhh right. Thank you very much for explaining this!


Paul 2022 年 1 月 1 日
I think the ode needs to be solved first, and then sub in the values of y(0) to get the family of solutions (if I understand the question)
syms y(t) C
ode = diff(y,t) == 40*C-40/280*y;
ysol(t) = dsolve(ode)
ysol(t) = 
Now solve for the constant C1 by enforcing the initial condition
syms C1
C1 = solve(ysol(0) == C,C1)
C1 = 
Now sub back into the solution
ysol(t) = subs(ysol(t))
ysol(t) = 
Now sub in some values of C for specific initial conditions
y(t) = subs(ysol(t),C,[1 2])
y(t) = 
  3 件のコメント
Yasmine Abdu
Yasmine Abdu 2022 年 1 月 1 日
Thank you for the great explainations- i see where ive been going wrong it makes perfect sense now.


Community Treasure Hunt

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

Start Hunting!

Translated by