Can not calculate coefficient Accurately
조회 수: 1 (최근 30일)
이전 댓글 표시
My equation is
Disp =X1*(4*X2 - 4*X1 + 1)
I am using Fallowing Command
[EQ_01, T] =coeffs(Disp , [X1 X2])
N1 = EQ_01(1) by using this cammand i got fallowing answer
N1 = -4
My required answer is 1 - 4X1
N2 = EQ_01(2) by using this cammand i got fallowing answer
N2 =4
My required answer is
4X1
댓글 수: 0
답변 (2개)
Lokesh
2024년 3월 27일
Hi inzamam,
As per my understanding, the values of coefficients returned from 'coeffs' is different from your expected values.
Given your equation 'Disp =X1*(4*X2 - 4*X1 + 1)' and the MATLAB command '[EQ_01, T] =coeffs(Disp , [X1 X2])' , 'coeffs' returns the coefficients of 'Disp' with respect to the symbolic variables 'X1' and 'X2'. When extracting coefficients of 'Disp' with 'X1' and 'X2' as variables, the equation simplifies to '-4X1^2 + 4X1X2 + X1'. This operation will return the coefficients of 'X1^2', 'X1X2' , and 'X1', which are -4, 4, and 1, respectively.
It is important to note that when obtaining coefficients with respect to 'X1', 'X1' itself cannot appear in the coefficients. This is because the operation is designed to isolate the factors multiplying 'X1' directly, not to include 'X1' as part of its own coefficient.
Refer to the following documentation to know more about 'coeffs':
댓글 수: 0
Star Strider
2024년 3월 27일
Only request the coefficients of ‘X2’ and then divide ‘EQ_01(2)’ by ‘X1’ —
syms X1 X2
Disp = X1*(4*X2 - 4*X1 + 1)
[EQ_01, T] =coeffs(Disp , X2)
EQ_01(2) = EQ_01(2)/X1
If you are required to get that result without the extra division by ‘X1’, be sure that you entered ‘Disp’ correctly.
.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!