How do I subtract matrix polynomials? I want to subtract D which is a cell array from Y a matrix polynomial
syms s
X=[1 2 3 4; 5 6 7 8];
Y=(s-2)*X;
D = {[1 2 ] , [1 3] ; [1 6] , [5 2] };
M=Y-D
Currently i'm getting error for this code saying 'Error using mupadmex Cell input must have string contents.'

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 10일

1 개 추천

syms s
X=[1 2 3 4; 5 6 7 8];
Y=(s-2)*X;
D = {[1 2 ] , [1 3] ; [1 6] , [5 2] };
M=Y-cell2mat(D)

댓글 수: 7

RoboKid
RoboKid 2013년 11월 10일
What if the size of matrix,cell2mat(D) doesn't match with Y. i.e for the same program what if D = {[1 2 7] , [1 3 8] ; [1 6 7] , [5 2 9] }
--Thanks
Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 10일
Then you have to explain what you want ?
RoboKid
RoboKid 2013년 11월 10일
I'm trying to solve generalized Bezout identity for MIMO system as mentioned in the following paper https://www.dropbox.com/sh/tokqmnjbs6m8nem/amHkp4MlVY. There I have to subtract Denominator matrix array D, from (s-2)*K (K is transpose of state feedback matrix). I need a generalized program , works for any D . Is there anyway other than cell2mat?
--Thanks
RoboKid
RoboKid 2013년 11월 10일
편집: RoboKid 2013년 11월 10일
syms s X=[1 2 3 4; 5 6 7 8]; Y=(s-2)*X; D = {[1 2 ] , [1 3] ; [1 6] , [5 2] }; t=mat2cell(Y) M=gsubtract(t,D)
I modified the program as above so that both Y and D are cell. But the problem now is Y is of class 'sym' and D is of class 'Double' . Is there anyway to change the class of D to sym from Double.
--Thanks
Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 10일
Sorry, I'am not following you
RoboKid
RoboKid 2013년 11월 10일
Is there anyway to change the class of D to sym from Double.
Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 10일
편집: Azzi Abdelmalek 2013년 11월 10일
cellfun(@(x) sym(x),D,'un',0)
In your case D is not double, it's cell

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Function Creation에 대해 자세히 알아보기

질문:

2013년 11월 10일

편집:

2015년 5월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by