How can I equate coefficients of the like powers from rhs and lhs in an equation to obtain a system of ODEs?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi everyone, I have a long equation EQ12.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/333057/image.png)
Is there a way of getting this from Symbolic Math Toolbox? I have tried to play around with coeffs but no luck. Thank you in advance for any help. Cheers.
1 comentario
Walter Roberson
el 17 de Jul. de 2020
See coeffs() . You might want to use the 'all' option to make it easier to match up.
But have you considered using odeFunction ? I recommend following the workflow given in the first example there.
Respuestas (1)
Devineni Aslesha
el 20 de Jul. de 2020
Hi Silvia,
You can use the coeffs function to equate like powers of t and obtain the corresponding ODEs.
eqn = lhs(EQ12)-rhs(EQ12) == 0
c = coeffs(eqn,t)
Here, c is a 1*6 symbol in which c(1,1) = "- diff(F[0](z), z, z) + diff(F[0](z), z) + F[0](z)^2" which is the coefficient of t. Similarly, you have coefficients for other powers of t. Now, you can use the equation c(1,1) == 0 for further calculations.
For more information, refer the following links
1 comentario
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!