matlab仿真错误记录

来源:互联网 发布:旷视科技 知乎 编辑:程序博客网 时间:2024/05/16 18:04

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‘就可以了。(具体为什么我也不知道,貌似自己做的模块可以直接读取属性名,系统的通常名字很长,也许有特定的映射关系<--这个在“Help->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)

原创粉丝点击