Why 'Port width mismatch' error occurred?

조회 수: 2 (최근 30일)
Patryk Oles
Patryk Oles 2021년 4월 3일
답변: vidyesh 2024년 2월 20일
I have created model like this. I have one error that I cannot understand, in MATLAB Function4 showed: Port width mismatch.
Input 'q3' expects a signal of size 1. The signal received is of size [4x4].
Why is that if Function4 is:
function [fi,teta,psi] = fcn(q3)
fi = 180/pi*atand2(2*q3(1)*q3(2)+2*q3(3)*q3(4) , 1-2*q3(2)*q3(2)-2*q3(3)*q3(3));
teta = 180/pi* asind(2*q3(1)*q3(3)-2*q3(2)*q3(4));
psi = 180/pi*atand2(2*q3(1)*q3(4)+2*q3(2)*q3(3) , 1-2*q3(3)*q3(3)-2*q3(4)*q3(4));
end
And previous function output is [4x4]

답변 (1개)

vidyesh
vidyesh 2024년 2월 20일
Hi Patryk,
It seems there might be a small typo in your function block. The correct function name is atan2d, not 'atand2'. After updating the function calls to atan2d, I tested your function block with a [4x4] matrix input, and the simulation executed without any errors.
For further clarification on the atan2d function, you can consult the following MATLAB documentation page:
Hope this helps.

카테고리

Help CenterFile Exchange에서 Install Products에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by