24小时热门版块排行榜    

查看: 4473  |  回复: 4

林传统

铜虫 (初入文坛)

[求助] 想把m文件在simulink 中的调用,我用的是matlab function 模块。

RT   我的m文件的代码是function  h_vs= fcn(T_s)
B13=  [-575.520*10^-4  117.700*10^-5   491.369*10^-8      782.701*10^-2   -815.233*10^-3      256.383*10^-4     149.856*10^-1   -209.283*10^-2];
a=zeros(1,8);
for i=1:8
    a(i)=B13(i);
end
coder.extrinsic('syms');
syms  h_vs u v;
T_s=T_s+273.15-61;
v=T_s-203.15;   
u=(h_vs-350)^0.5-2.24076;
x=solve(u^3+a(1)*u^2*v+a(2)*u*v^2+a(3)*v^3+a(4)*u^2+a(5)*u*v+a(6)*v^2+a(7)*u+a(8)*v,h_vs);
y=max (real (double (subs(x))));
h_vs=y;
end
  复制到matlab function中想要调用却出现如下8个错误:

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.
Component: MATLAB Function | Category: Coder error
Undefined function or variable 'h_vs'. The first assignment to a local variable determines its class.

Function 'MATLAB Function' (#71.303.307), line 12, column 4:
"h_vs"
Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Undefined function or variable 'u'. The first assignment to a local variable determines its class.

Function 'MATLAB Function' (#71.334.335), line 13, column 9:
"u"
Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Undefined function or variable 'x'. The first assignment to a local variable determines its class.

Function 'MATLAB Function' (#71.443.444), line 14, column 27:
"x"
Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Undefined function or variable 'y'. The first assignment to a local variable determines its class.

Function 'MATLAB Function' (#71.455.456), line 15, column 6:
"y"
Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Errors occurred during parsing of MATLAB function 'MATLAB Function'
Component: MATLAB Function | Category: Coder error
Errors occurred during parsing of MATLAB function 'MATLAB Function'
Component: Simulink | Category: Block error
Error occurred in 'sim_hvs/MATLAB Function'.
Component: Simulink | Category: Block error

图片在附件;
求大神解决

想把m文件在simulink 中的调用,我用的是matlab function 模块。
捕获.PNG
回复此楼
111
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
祝福
2楼2016-08-27 23:02:46
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
祝福
3楼2016-08-28 00:17:19
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
祝福
4楼2016-08-28 00:53:44
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

Andrew_Yao

新虫 (小有名气)

问题解决了吗?
5楼2020-06-07 20:57:06
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 林传统 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 今天系统多次维护,明天很可能放榜! +5 zju2000 2026-08-16 5/250 2026-08-16 23:23 by Haru815
[基金申请] 欢迎发来filecode的Mz6后的代码验证其规律 +32 医学老男孩 2026-08-13 74/3700 2026-08-16 21:05 by 医学老男孩
[论文投稿] 岩土工程学报什么时候才能终审完呐 25+3 yeager111 2026-08-10 4/200 2026-08-16 20:42 by tfang
[基金申请] 时间戳又变了8-15 +13 archvillain 2026-08-15 25/1250 2026-08-16 20:13 by zhaosm1982
[基金申请] 快农历七夕节了,轻松一下,男人悄悄话,女施主请不要进来。 +3 Tide man 2026-08-14 3/150 2026-08-16 17:47 by jurkat.1640
[基金申请] 哪位老哥知道今年的国自然具体哪一天放榜? +9 Ldrop2023 2026-08-13 9/450 2026-08-16 13:24 by wukun_007
[基金申请] 咱们一起用铁证分析2026国家社科基金中标与否 +7 启萌科技 2026-08-12 26/1300 2026-08-16 12:35 by 启萌科技
[基金申请] 有时候,自然基金真的不能太认真 (我的申报经验) +10 majunge000 2026-08-11 12/600 2026-08-16 08:18 by xli1984
[精细化工] 招聘 金属平磨液,抛光液研发工程师 +3 小天0311 2026-08-14 3/150 2026-08-16 07:31 by H9PLUS
[基金申请] filecode +8 cratir 2026-08-14 12/600 2026-08-15 18:08 by zyfgau
[基金申请] 各位道友,我要去昆明玩几天,回来见。 +7 Tide man 2026-08-14 8/400 2026-08-15 01:11 by arzu_hma
[基金申请] filecode +15 documentary 2026-08-10 17/850 2026-08-14 10:08 by kissu88
[基金申请] 静等基金结果 +8 gjjjzhong 2026-08-10 21/1050 2026-08-13 17:56 by 且听虎啸
[基金申请] 重要来源:本周末出结果 +10 瞬息宇宙 2026-08-12 10/500 2026-08-13 15:46 by likettle
[基金申请] 不应该看fileCode +7 且听虎啸 2026-08-12 9/450 2026-08-13 14:27 by flydreamws
[基金申请] 分享一下我之前已中青C的计划书的filecode +4 布布和一二 2026-08-11 5/250 2026-08-13 12:56 by cratir
[基金申请] 2019年青年基金涵评意见,大家看看几个A,几个B? +11 Tide man 2026-08-11 11/550 2026-08-13 07:35 by 撸猫猫
[基金申请] 为什么网上很多人说本周 12号出结果 +6 瞬息宇宙 2026-08-10 7/350 2026-08-11 19:25 by Tide man
[基金申请] 什么时候出结果,有咨询渠道??? +3 Tide man 2026-08-11 3/150 2026-08-11 17:54 by kudofaye
[基金申请] 据悉今年马上要出结果了 +7 瞬息宇宙 2026-08-10 8/400 2026-08-10 12:42 by Vivilian
信息提示
请填处理意见