Solving for coefficients : Substitution error

1 Ansicht (letzte 30 Tage)
Rakesh Jain
Rakesh Jain am 27 Sep. 2017
Bearbeitet: Rakesh Jain am 27 Sep. 2017
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])

Antworten (1)

KSSV
KSSV am 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])
  1 Kommentar
Rakesh Jain
Rakesh Jain am 27 Sep. 2017
Bearbeitet: Rakesh Jain am 27 Sep. 2017
The error is not coming now but the Values of b and c are not getting substituted in d by the above code. The output still shows d in terms of b and c only. 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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Polynomials finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by