24小时热门版块排行榜    

Znn3bq.jpeg
查看: 4309  |  回复: 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的回帖
相关版块跳转 我要订阅楼主 林传统 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 260求调剂 +3 Zyt1314520.. 2026-04-17 4/200 2026-04-17 21:06 by Eurekall
[考研] 304求调剂 +7 castLight 2026-04-16 7/350 2026-04-17 20:05 by 关一盏灯cd
[考研] 0854求调剂 +21 门路摸摸 2026-04-15 25/1250 2026-04-17 15:45 by qzxyhcsy
[考研] 一志愿沪9,326求生物学调剂 +11 刘墨墨 2026-04-13 11/550 2026-04-17 15:35 by wanganpin
[考研] 279求调剂 +13 张番茄不炒蛋 2026-04-11 13/650 2026-04-17 10:38 by cuisz
[考研] 297,工科调剂? +4 河南农业大学-能 2026-04-14 4/200 2026-04-16 22:52 by wulijun2012
[考研] 一志愿沪9,生物学326求调剂 +9 刘墨墨 2026-04-15 9/450 2026-04-16 17:14 by 崔崔崔cccc
[考研] 291求调剂 +11 关忆北. 2026-04-14 11/550 2026-04-16 15:18 by jiahl2024
[考研] 327求调剂 +26 Xxjc1107. 2026-04-13 29/1450 2026-04-16 10:52 by Espannnnnol
[考研] 求调剂 +11 小聂爱学习 2026-04-11 15/750 2026-04-15 21:57 by noqvsozv
[考研] 一志愿A区211,22408 321求调剂 +6 随心所欲☆ 2026-04-15 7/350 2026-04-15 21:45 by lbsjt
[考研] 求助调剂,跨调 +19 X十甫寸Y 2026-04-11 20/1000 2026-04-15 21:18 by cuisz
[考研] 药学305求调剂 +7 玛卡巴卡boom 2026-04-11 7/350 2026-04-15 13:21 by 西北望—风沙
[考研] 考研调剂 +13 长弓傲 2026-04-13 14/700 2026-04-14 14:44 by zs92450
[考研] 245求调剂 +6 冰糖橘?汽水 2026-04-13 10/500 2026-04-14 10:49 by jyl0317
[考研] 300分求调剂 (085501机械专硕,本科扬大) +9 xu@841019 2026-04-11 10/500 2026-04-14 08:48 by 木木mumu~
[考研] 材料考研调剂 +29 云木达达 2026-04-11 31/1550 2026-04-13 13:32 by lyh鲁老师
[考研] 339求调剂 +4 hanwudada 2026-04-12 4/200 2026-04-13 12:03 by 蓝云思雨
[考研] 283求调剂 086004考英二数二 +17 那个噜子 2026-04-10 18/900 2026-04-11 16:27 by 明月此时有
[考研] 调剂 +5 文道星台 2026-04-11 5/250 2026-04-11 15:01 by 凯凯要变帅
信息提示
请填处理意见