Trouble using dsolve function
36 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I need help in solving a 2nd order diff equations. Since my equations are very long (almost 30 lines), I have written a similar code below to explain my question.
z= a*x+b*x^2+c+........; S =dsolve('D2y +5*z+ 2*x + 10*z^2','x')
Now since my z equation is very long I need to substitute z in the dsolve function. I tried using inline function by doing this
z = inline ('a*x+b*x^2+c+........')
but I am not sure if the dsolve program is taking the value of z. Its running though, and it says no explicit solution found and returns me an empty symbol. Am I doing the right thing or is there any other way to do it.
0 comentarios
Respuesta aceptada
Walter Roberson
el 20 de En. de 2012
z = a*x+b*x^2+c+........;
eqn = subs(sym('D2y +5*z+ 2*x + 10*z^2'), z, z);
S = dsolve(eqn, x);
Myself, I would probably toss in a simplify() around the subs() .
2 comentarios
Walter Roberson
el 20 de En. de 2012
The syntax I used is valid for the case of exactly one thing to substitute in. When you have multiple things to substitute in, you must form lists.
eq1 = simplify(subs(...., {'N1', 'N2', 'N3'}, {N1, N2, N3}))
Más respuestas (2)
Ver también
Categorías
Más información sobre Function Creation en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!