필터 지우기
필터 지우기

Output sizes for MATALB function block in Simulink.

조회 수: 3 (최근 30일)
gdz
gdz 2023년 1월 30일
댓글: gdz 2023년 2월 1일
Hi,
I would like to use Simulink to do some calculation. In Simulink, there is a constant block sending the input, passing to the MATLAB function, and display the output in a Display block. The function has been tested and worked well on MATLAB, but an error occur in simulink:
Simulink does not have enough information to determine output sizes for this block. If you think the errors below are inaccurate, try specifying types for the block inputs and/or sizes for the block outputs.
%MATLAB function
function y = fcn(u)
B = 0;
A = 100*(10/u-1);
F=@(x)[6*exp(-39*10^(-3)*x)+230*exp(-6*10^(-5)*x)-A];
B = fsolve(F,0,optimoptions('fsolve','Algorithm','levenberg-marquardt'));
y = B;
Any suggestion will be appreciated. Thank you.

채택된 답변

Fangjun Jiang
Fangjun Jiang 2023년 1월 31일
It is interesting that you want to do this. Does the solution "B" always exist? How many solutions are there and are there always the same number of solutions?
Anyway, those questions are related to the error message. You could try to resolve it this way. In the M Editor, click menu button "Edit Data" and set the size of "B" or "y" or both.
  댓글 수: 1
gdz
gdz 2023년 2월 1일
Thank you for the reply. It solves my problem.
The B does not exist all the time, so i will set a range for the input u. There are alway one solution and the solution will be the same.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by