MATLAB Function takes [4x1] signal as parameter, but in debug shows as [3x1]. Workaround/fix?
조회 수: 11 (최근 30일)
이전 댓글 표시
The context here is I am using a MATLAB function which takes a parameter y (x_est) which is shown to be a [4x1] signal above. When 'make model' is clicked it gives the error below:
On inspection of the diagnostic report:
This shows that the [4x1] signal (which is initialised as [4x1] by an integrator block) is being interpreted as [3x1]. I am clueless as to why.
댓글 수: 1
Yash
2024년 10월 1일
Hi Ben,
This is an unexpected behaviour. Does the issue persist if you remove the logic on the Right Hand Side of the MATLAB function block (including the feedback loop)? There is a possibility that the feedback loop is chaging the input size after a few iterations.
If the issue still persist, share the model here so that we can have a look at the issue.
답변 (1개)
Arnav
2024년 11월 7일 5:15
From the image of the model provided, the Mux block combines 2 signals of width 2 and this is provided as input to the Gain block. The gain is using depicted through matrix multiplication (indicated as K*u on the mask where K is the gain).
It is not possible for the output to be a signal of width 2 for any gain matrix. The output of the gain block is provided as feedback to the system that computes speed_observation. Due to this, Simulink is unable to find the correct dimensions for the signals because signal dimensions are defined by a cyclic relationship.
You can fix this by directly using the speed_observation signal as input to the Gain block.
You can refer to the documentation of Gain block and Mux block to understand how dimensions of input and output signals are computed:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Configure and View Diagnostics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!