Coeffs and collect partially work
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have this symbolic function which is a series of pure waves in time, with coefficients depending on other constant (symbolic) variables, say:
x_result = f1(a,b,c) * sin(t) + f2(a,b,c) * sin(2*t) ...
and so on, where a,b,c and t are assumed real symbolic variables.
The function is a result of a symbolic solution using 'dsolve'.
When I try to get the coefficient of
or
, coeffs and collect work perfectly, yet when I try it with some other frequency coeffs and collect give exactly x_result; for example for
they return the entire expression of x_result and not an array with f2(a,b,c) as the second term. This problem is consistent with any frequency other than 1, and regardless of if I simplify or expand x_result.
The only thing I found that corrects this, is printing x_result to the console
disp(x_result)
and then copying the outputed value and assigning x_result this copied value (i.e., x_result = -value of x_result copied from console-).
Since x_result is usually very long in my code, this method would not be helpful as after a certain point the output would be truncated.
My goal is to be able to directly obtain the coefficients of the different waves of x_result without any "by hand" manipulations.
Any help would be appreciated.
3 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!