24小时热门版块排行榜    

Znn3bq.jpeg
查看: 4305  |  回复: 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的回帖
相关版块跳转 我要订阅楼主 林传统 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 297工科调剂? +14 河南农业大学-能 2026-04-13 15/750 2026-04-15 13:25 by 黑科技矿业
[考研] 材料工程281还有调剂机会吗 +43 xaw. 2026-04-11 44/2200 2026-04-15 12:46 by 西北望—风沙
[考研] 085400电子信息类(川大控制工程)求调剂可跨专业 求老师联系 +6 626776879 2026-04-08 6/300 2026-04-14 20:09 by gwjxiaolang
[考研] 化工学硕294分,求导师收留 +32 yzyzx 2026-04-12 36/1800 2026-04-14 17:45 by lhj2009
[考研] 300分求调剂 (085501机械专硕,本科扬大) +9 xu@841019 2026-04-11 10/500 2026-04-14 08:48 by 木木mumu~
[考研] 材料085601调剂 +32 何润采123 2026-04-10 34/1700 2026-04-14 08:47 by 木木mumu~
[考研] 机械工程313分找工科调剂 +4 双一流本科机械 2026-04-08 4/200 2026-04-14 07:32 by Abskk
[考研] 一志愿双非085400电子信息344 求调剂,对材料和化学方向也感兴趣 +12 无情的小羊 2026-04-09 13/650 2026-04-13 14:17 by 张zhihao
[考研] 一志愿0807 数一英一 313 有没有二轮调剂 +12 emokidd 2026-04-08 13/650 2026-04-13 08:32 by lhj2009
[考研] 291求调剂 +8 关忆北. 2026-04-11 8/400 2026-04-12 09:32 by 逆水乘风
[考研] 277 数一104,学硕,求调剂 +21 瓶子PZ 2026-04-09 23/1150 2026-04-11 23:12 by labixiaoqiao
[考研] 303求调剂 +14 SereinQ 2026-04-10 15/750 2026-04-11 20:43 by 蓝云思雨
[考研] 289 分105500药学专硕求调剂(找B区学校) +6 白云123456789 2026-04-09 8/400 2026-04-10 21:13 by zhouxiaoyu
[考研] 314求调剂 +18 xhhdjdjsjks 2026-04-09 19/950 2026-04-10 18:53 by HPUCZ
[考研] 一志愿京区985,085401电子信息,本科电子信息 +3 阳光开朗的男孩 2026-04-10 3/150 2026-04-10 16:29 by sophia_93
[考研] 298求调剂 +13 钉叮咚冬瓜 2026-04-09 13/650 2026-04-10 15:49 by jiajinhpu
[考研] 求调剂 +11 翩翩一书生 2026-04-09 13/650 2026-04-10 10:27 by liuhuiying09
[考研] 材料专硕(0856) 339分求调剂 +9 哈哈哈鹅哈哈哈 2026-04-09 10/500 2026-04-09 20:01 by Orcid
[考研] 一志愿中科院105500专业总分315求调剂 +6 lallalh 2026-04-09 7/350 2026-04-09 17:51 by lallalh
[考研] 283电子信息求调剂 +4 三石WL 2026-04-08 4/200 2026-04-09 10:21 by wp06
信息提示
请填处理意见