前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >matlab 仿真 报错,matlab仿真错误记录

matlab 仿真 报错,matlab仿真错误记录

作者头像
全栈程序员站长
发布2022-08-31 18:23:39
1.3K0
发布2022-08-31 18:23:39
举报

大家好,又见面了,我是你们的朋友全栈君。

1. 求数值积分quadl函数。被积函数表达式需要写成点乘(点操作)的形式, 否则要不积出的结果不对,要么报错。

2. simulink的打开错误:Unable to open the block or model file named ‘*’.

解决:路径不对,将当前路径切换到模块所在路径。

3. simulink运行时出现Warning: The model ‘*‘ does not have continuous states, hence using the solver ‘VariableStepDiscrete’ instead of the solver ‘ode45’ specified in the Configuration Parameters dialog.

这是一个警告,对仿真结果没有影响,去掉的方法是:Simulation -> Configuration Parameters中的solver选择’Discrete (no continuous states)’。

该警告出现的原因:The reason for the first warning is because you don’t have any continuous states in your model, only discrete states, so Simulink changed the solver from ode45 (which is what you specified the solver to be, and which is a variable-step solver that handles continuous states) to the “VariableStepDiscrete” solver, which is also a variable-step solver but designed to handle only discrete states. To get rid of the warning, change the solver from ode45 to VariableStepDiscrete in the configuration parameters (see Andreas’ answer). Ref

4. simulink使用set_param()函数调用模块参数,报错:Multipath Rician Fading Channel block (mask) does not have a parameter named ‘Initial seed’.

原因:函数读不出Rician Fading模块中的Initial seed属性,把函数参数改成’seed‘就可以了。(具体为什么我也不知道,貌似自己做的模块可以直接读取属性名,系统的通常名字很长,也许有特定的映射关系)Simulink->Mask Parameters”中有说明,通过get_param(‘obj’, ‘DialogParameters’)可以获取当前模块的所有属性名称。

5. 关于simulink最重要的一点,有什么不懂的读一读matlab自带的Help document,非常非常有用,比找中文参考书强多了。

举个例子,做Rician fading信道仿真时,Rician Fading模块通常只负责产生fading,噪声的话需要在后面级联一个AWGN模块。这个在Help里的Contents->Channels中有介绍。

最后的rician SNR参数可以这样归一化:1)把AWGN的“Input signal power”设为1,”Eb/No (dB)”设为1,这样channel的噪声功率被归一化成1dB;2)在Rician Fading模块里设置“Average path gain vector (dB)”就可以把这个参数当做channel*等效均值信噪比*来用(需要注意,这个参数是信号包络的增益,要根据x->x^2和 dB = 10logx的关系来转换)。(这个结论是错的)

6. 向.txt文件中输出结果时不显示回车

-> matlab打开模式的问题:在 matlab 中存储成为二进制还是文本文件取决于fopen的方式,如果用wt,则存储为文本文件,这样用记事本打开就可以正常显示了;如果用w则存储为二进制文件,这样用记事本打开会出现小黑方块,要正常显示的话,可以用写字板或UltraEdit等工具打开。(Ref)

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/143699.html原文链接:https://javaforall.cn

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022年5月2,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档