24小时热门版块排行榜    

查看: 4471  |  回复: 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的回帖
相关版块跳转 我要订阅楼主 林传统 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[论文投稿] 岩土工程学报什么时候才能终审完呐 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
[基金申请] 2027广东省杰青 +3 奶牛小黑 2026-08-15 6/300 2026-08-16 20:07 by 奶牛小黑
[基金申请] 快农历七夕节了,轻松一下,男人悄悄话,女施主请不要进来。 +3 Tide man 2026-08-14 3/150 2026-08-16 17:47 by jurkat.1640
[基金申请] 咱们一起用铁证分析2026国家社科基金中标与否 +7 启萌科技 2026-08-12 26/1300 2026-08-16 12:35 by 启萌科技
[基金申请] 我的国基提前知道中了,可是同事的操作让我实在接受不了,怎么会有这样的人 +11 家与远方 2026-08-10 16/800 2026-08-16 10:28 by ray43
[基金申请] 有时候,自然基金真的不能太认真 (我的申报经验) +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=后面第一个是大写字母 +6 wangze12014 2026-08-14 7/350 2026-08-15 20:12 by gltch
[基金申请] 小木虫上这么多卖论文的,真有人买论文么?感觉没必要啊 +12 Tide man 2026-08-10 13/650 2026-08-15 16:34 by 氺木
[基金申请] 是这周出结果还是下周出结果? +4 yuleib84 2026-08-11 4/200 2026-08-14 23:05 by lfy8008
[硕博家园] 读博的好处 +4 lnee 2026-08-11 4/200 2026-08-14 10:20 by ahsoarli
[基金申请] 静等基金结果 +8 gjjjzhong 2026-08-10 21/1050 2026-08-13 17:56 by 且听虎啸
[基金申请] 不应该看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
[基金申请] 结合人工智能,周易传统文化,filecode打分制来了,3分以上希望很大。 +3 Tide man 2026-08-12 4/200 2026-08-13 08:35 by ZJTJZ
[基金申请] 帮忙看看fileCode +7 wwncly 2026-08-10 13/650 2026-08-11 19:36 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
[基金申请] 确定了,国自然21号放榜 +6 布布和一二 2026-08-10 7/350 2026-08-10 19:15 by 2000zf36392
信息提示
请填处理意见