How to extract symbolic parts and corresponding constant values with division in symbolic polynomials?
9 views (last 30 days)
Show older comments
if the polynomial function f is given like this, I can use coeffs function
syms x
f = cos(x)+x;
[a,b]=coeffs(f)
However, if the function f is give as follows
syms x dxdt
f=cos(x)/x+ (x+5)/(x+3);
[a,b]=coeffs(f)
it returns error.
The result I want to have it
a = [1 1 5]
b = [ cos(x)/x x/(x+3) 5/(x+3) ]
Would it be any way to return this result??
Best,
0 Comments
Answers (1)
Star Strider
on 22 Oct 2021
I cannot find any function that would return the desired result, however ther are other options, a few of which are —
syms x dxdt
f=cos(x)/x+ (x+5)/(x+3)
pff = partfrac(f,x)
ff = factor(f)
cf = children(f)
.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!