How do you multiply one single constant value with a 1D array/matrix containing 25 values in Simulink?

조회 수: 5 (최근 30일)
Hi
I am using a constant block which contains an array of 25 elements in the form [0,1,2,3,......]. I also have another signal that contains a single value e.g. 5. I would like to multiply 5 with each of the elements in that array represented by a constant.
When I try to use the simulink product block I get an error saying "Error in port widths or dimensions. Invalid dimension has been specified for input port 1 of 'Combined/Product1'."
How do I get over this error?
Thanks

채택된 답변

Mischa Kim
Mischa Kim 2014년 4월 1일
편집: Mischa Kim 2014년 4월 1일
James, simply use a Gain block (Commonly Used Blocks) and choose Element-wise multiplication (double-click to open the block). The same should work also with the Product block.
  댓글 수: 4
Mischa Kim
Mischa Kim 2014년 4월 1일
in1 would be the step signal. The constant is a vector with 25 elements.
James Murray
James Murray 2014년 4월 1일
Thank you so much for your constant help in my questions. That helped a lot.

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

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2014년 4월 1일
You can use a product block

카테고리

Help CenterFile Exchange에서 Array and Matrix Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by