Is there any way to multiply strings like they're variables?
이전 댓글 표시
Hi all, So Im trying to write some code that will allow me to find a state space. In order to do this, I need to multiply some matrices. However, some of the matrices are filled with transformers-which im currently representing as -and would be helpful to represent as- strings. (I could define the values of these transformers, but I really want to "see" the final multiplied transformer combinations, not the numerical values of there products). The problem is, whenever I try to define matrices with stings in them, matlab doesn't preserve the columns, I just get matrices with rows of all the strings multiplied together. Is there a way to multiply strings like variables?
Ive attached the code of my incorrect attempt below.
I=[1 0; 0 1;]
E=['-T15_11' '-T15_12' '-T15_13' '-T15_14'; '-T16_11' '-T16_12' '-T16_13' 'T16_14';]
F=[['((I1/I17)*T11_15)', '((I1/I18)*T11_16)'], ['((I2/I17)*T12_15)', '((I2/I18)*T12_16)'], ['((I3/I17)*T13_15)', '((I3/I18)*T13_16)'], ['((I4/I17)*T14_15)', '((I4/I18)*T14_16)']]
A=[[0, 0], [0, 0]];
B=[[0, 0, 'T15_12', 'T15_14'], [0, 0, 'T16_12', 'T16_14']];
ABcoef=(I-(E*F));
Anew=inv(ABcoef)*A
Bnew=inv(ABcoef)*B
Thanks.
답변 (1개)
Azzi Abdelmalek
2016년 1월 7일
0 개 추천
You can use symbolic variables http://www.mathworks.com/help/symbolic/create-symbolic-numbers-variables-and-expressions.html
카테고리
도움말 센터 및 File Exchange에서 Function Creation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!