Solving for coefficients : Substitution error

조회 수: 1 (최근 30일)
Rakesh Jain
Rakesh Jain 2017년 9월 27일
편집: Rakesh Jain 2017년 9월 27일
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])

답변 (1개)

KSSV
KSSV 2017년 9월 27일
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
Rakesh Jain
Rakesh Jain 2017년 9월 27일
편집: Rakesh Jain 2017년 9월 27일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by