フィルターのクリア

Simulink cannot determine sizes and/or types of the outputs for block 'MATLAB Function'

101 ビュー (過去 30 日間)
Ryan Rizzo
Ryan Rizzo 2018 年 11 月 18 日
回答済み: 泊先 姚 2021 年 9 月 14 日
I have a small Simulink model as follows:
and the resepctive code:
function [xdot,y] = fcn(x,u)
% define your constants
g = 9.81;
m = 0.05;
R = 1;
L = 0.01;
C = 0.0001;
x1 = 0.012;
x2 = 0;
x3 = 0.84;
% nonlinear set of equations
xdot = [x2; g-((C/m)*(x3/x1)^2); -((R/L) +(((2*C)/L)*(((x2*x3)/((x1)^2)))))] + [0;0;1/L]*u;
y = x';
However when I try to run, Simulink generates the following errors:
Inferred size ('[1 3]') for data 'y' does not match specified size ('scalar').
Component:MATLAB Function | Category:Coder error
Simulink cannot determine sizes and/or types of the outputs for block 'MATLAB Function' due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
I searched through some documentation for variable size inputs and outputs, selected the variable size check box and also entered the upper bound as [1 3].
When I try to run again I get:
Expression '[1 3]' for maximum of data 'y' must evaluate to a scalar.
I'm not sure how to solve this error. I also looked here, but still couldnt get it to work.
Any help would be appreciated.

回答 (1 件)

泊先 姚
泊先 姚 2021 年 9 月 14 日
You can set all of those options back to their default values.

カテゴリ

Help Center および File ExchangeEvent Functions についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by