Solving for coefficients : Substitution error
3 views (last 30 days)
Show older comments
In the below matlab code, I m solving for the coefficients b,c,d,e,f by comparing to a known equation. In the second last line of the code, I get d which is a function of b and c. I want to substitute the values of b and c obtained in the third last line and fourth last line to get a constant value of d. How should I do it. The below code is showing an error due to last line.
syms x b c d e f kpc
s1 = -0.45+ 0.35i
s2 = -0.45 -0.35i
DomiPoles = expand((x+s1)*(x+s2))
N=0.36111*kpc + 225.0*x + 1.0*kpc*x + 1.1111*kpc*x^2 + 606.96*x^2 + 799.0*x^3 + 444.0*x^4 + 127.0*x^5 + 18.0*x^6 + 1.0*x^7 + 27.455
h= expand(DomiPoles*(x^5 + b*x^4 + c*x^3 + d*x^2 + e*x + f))
C = coeffs(N - h,x)
b =solve(C(7),b)
c = subs(solve(C(6),c),b)
d = solve(C(5),d)
d = subs(solve(C(5),d),[b, c],[b,c])
0 Comments
Answers (1)
KSSV
on 27 Sep 2017
syms x b c d e f kpc
s1 = -0.45+ 0.35i
s2 = -0.45 -0.35i
DomiPoles = expand((x+s1)*(x+s2))
N=0.36111*kpc + 225.0*x + 1.0*kpc*x + 1.1111*kpc*x^2 + 606.96*x^2 + 799.0*x^3 + 444.0*x^4 + 127.0*x^5 + 18.0*x^6 + 1.0*x^7 + 27.455
h= expand(DomiPoles*(x^5 + b*x^4 + c*x^3 + d*x^2 + e*x + f))
C = coeffs(N - h,x)
b =solve(C(7),b)
c = subs(solve(C(6),c),b)
d = solve(C(5),d)
d = subs(d,[b, c],[b,c])
See Also
Categories
Find more on Polynomials in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!