Extracting coefficient Matrix and vector from available polynomial Expressions with exponential terms
조회 수: 7 (최근 30일)
이전 댓글 표시
Hello All,
I have stuck in one problem, where I have variable matrix vector available and I want to extract the coefficient matrix and variable vector from that original polynomial vector matrix. For e.g. if A is matrix as:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/219050/image.png)
and I want to extract its coefficients and variable vector as given below:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/219051/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/219052/image.jpeg)
So my question is how to compute or Extract Matrix Y and Matrix Z from A which comprises of expressions with exponential terms of eigenvalues of system matrix.
Is there any direct command? I tried commands like - coeffs, sysvar, equationsToMatrix but in all those cases the variables are fixed.
So, please help me in solving this above problem.
Thank You.
댓글 수: 0
채택된 답변
Star Strider
2019년 5월 12일
You have not shown what you already tried or what the results were.
In R2019a, this is possible with a for loop (since coeffs apparently doesn’t like matrices):
syms lambda1 lambda2 t
A = [exp(-lambda1*t)+3*exp(-lambda2*t); -2*exp(-lambda1*t)+4*exp(-lambda2*t)];
for k = 1:size(A,1)
[Ac{k},trm{k}] = coeffs(A(k,:));
end
Cfs = [Ac{1}; Ac{2}]
Trm = [trm{1}; trm{2}]
producing:
Cfs =
[ 1, 3]
[ -2, 4]
Trm =
[ exp(-lambda1*t), exp(-lambda2*t)]
[ exp(-lambda1*t), exp(-lambda2*t)]
That may be the best you can hope for.
댓글 수: 13
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!