Size mismatch error using Matlab function to solve equations
이전 댓글 표시
Hi All,
Im trying to use matlab function in simulink using the following code:
- function S= fcn (A,B,C,D,E)
- R=roots([A B C D E]); %ABCDE are coefficients of a polynomial that i want to solve and are preovided as real constants
- k=(zeros(1,4));
- k=R(imag®==0);% to discard the complex roots. this is my requirement
- k=real(k);
- S=zeros(1,4);
- S(:)=k;
The size of S is specified as [1,4] in the model explorer. I have to use fixed size calculations. When I run this code, I get a runtime error, "simulation stopped due to size mismatch error 4~=0." When I stop the debugger, the function block gets highlighted and I get the following error,: MATLAB Function Interface Error: Unknown MATLAB error encountered. Block Equation (#1512) While executing: none
Can somebody help me plese? Thanks in advance
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Simulink Coder에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!