horzcat-error in subs for certain values

Hi everyone,
has anyone an idea on the following problem? I tried to create a minimal example of the problem. But in any more simple form the error does not show up. I wanted to do some matrix algebra and find eigensolutions that match a certain condition. For this i wrote:
syms c a alpha;
A = [ ...
1 , 2*a + 40/2.23; ...
0 , 1 ...
];
B = [ ...
1 , 0; ...
-2/50 , 1 ...
];
C = [ ...
1 , c + (2*a+40+c)/cos(2*alpha); ...
0 , 1 ...
];
D = B*C*B*A;
zr = sqrt(4-(D(1,1)+D(2,2))^2)/(2*D(2,1))-3.15;
z = (D(1,1)-D(2,2))/(2*D(2,1));
laenge = 19;
winkel = 13;
kante = double(solve(subs(zr,[a, alpha],[ laenge , winkel * (pi/180)]) , c));
q = 1/complex(subs( z , [a,alpha,c] , [laenge,winkel*(pi/180),kante] ),opt)
Running this code, i will get a solution without problems. But if i change the variable 'winkel' a little to 13.2 it results in the error
'Error using horzcat. CAT arguments dimensions are not consistent.'
which is pretty weird for me. I was thinking whether my equations maybe don't have solutions for these parameters, but i solved it with the same parameters in mathematica without any problems. Anyone has an idea what i did wrong?
Thanks for your help.
Regards

댓글 수: 2

Jan
Jan 2014년 2월 26일
Please post the complete error message, which contain a hint to the corresponding line also!
Walter Roberson
Walter Roberson 2014년 2월 27일
Also, please show size() of all variables that appear in the line that is giving the error.

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

답변 (1개)

Benjamin
Benjamin 2014년 2월 28일

0 개 추천

Hi everyone,
I added the complete error message, but the hint about the size of the variables brought the solution. The variable 'kante' had two solutions after solving the given equation. In Mathematica i considered this by choosing one of the solutions. Here I didn't. Now I do and it works fine.
Thanks!

질문:

2014년 2월 26일

답변:

2014년 2월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by