Simulink Port Dimensions Error

조회 수: 2 (최근 30일)
Learning
Learning 2022년 11월 22일
댓글: VBBV 2022년 11월 23일
Hello everyone, new to Simulink. I have constant A (dimension is 7*7) multiplied by T (dimension is 1). I also have constant block B (size is 7*2) multiplied by an input block Y (dimensions is 2). I am using matrix multiplied for A*T and for B*Y. Equation therefore is M = A*T + B*Y. The using sum block to add them and output is M. The error is “Error in port widths or dimensions. Invalid dimension has been specified for input pot1” any help would be appreciated and even rules on setting the correct port dimensions would be appreciated.

답변 (1개)

VBBV
VBBV 2022년 11월 22일
편집: VBBV 2022년 11월 22일
M = A.*T + B*Y %
  댓글 수: 7
Learning
Learning 2022년 11월 22일
Thanks for your response! For some reason I am still getting an error that the size do not match. I tried reshaping Y which is a 2*1 matrix using Simulink block reshape.
VBBV
VBBV 2022년 11월 23일
Change the size of array Y from 2 x1 to 2 x7 as below
A = randi([0 7],7,7);
T = randi(1);
B = randi([0 7],7,2);
Y = randi([0 2],2,1) % change the size of Y (by zero padding)
Y = 2×1
1 1
Y = [Y(1) 0 0 0 0 0 0;Y(2) 0 0 0 0 0 0] % change it 2 x 7 by adding zeros
Y = 2×7
1 0 0 0 0 0 0 1 0 0 0 0 0 0
M = A*T + B*Y %
M = 7×7
5 7 4 6 7 6 4 5 5 6 0 7 0 6 13 5 6 3 4 6 1 16 6 1 4 0 1 6 14 7 0 7 1 3 0 18 1 3 0 3 2 3 10 3 4 3 5 3 7

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

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by