Borrar filtros
Borrar filtros

A question related to subs in ode (symbolic maths toolbox)

2 visualizaciones (últimos 30 días)
Angus Wong
Angus Wong el 3 de Jul. de 2019
Comentada: Angus Wong el 3 de Jul. de 2019
I have a line:
ode=diff(y,x)==x+y;
I want matlab to calculate diff(a,b), given a and b are real numerical values. However, the subs function allowed me only to either sub the value a or value b into the ode line, can anyone help?
I am expecting something like subs(ode,[x,1,y,2]) would give me 3, subs(ode,[x,4,y,5]) would give me 9.

Respuesta aceptada

madhan ravi
madhan ravi el 3 de Jul. de 2019
I am not sure what you are asking for perhaps an example below?:
>> syms x y
>> eqn = x+2*y
eqn =
x + 2*y
>> subs(eqn,{x,y},{2,5})
ans =
12
>>
  2 comentarios
madhan ravi
madhan ravi el 3 de Jul. de 2019
Perhaps ?:
>> syms y(x)
>> ode=diff(y,x)==x+y;
>> subs(rhs(ode)-lhs(ode),{x,y},{1,2})
ans(x) =
3
>> subs(rhs(ode)-lhs(ode),{x,y},{4,5})
ans(x) =
9
>>
Angus Wong
Angus Wong el 3 de Jul. de 2019
Thanks a lot! You do make my day.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by