1、simulink常见问题
问题1:scope波形图没有或者看不清

解决方案:你要使图像自适应,点击scope里面的这个按钮

问题2:运行代码出现下面提示框

解决方案:这是系统提示你的文件不在matlab的根目录下面。

这个为matlab的根目录。你要把对应的代码、模型之类的文件放在这个文件夹下面
问题3:simulink文件不能打开

解决方案:这是因为你的文件名字不对,simulink的文件名字不能有括号之类的符号,必须是字母或者字母加数字,或者下划线之类的。
2、Simulink数据导出到变量空间
方法1:通过out模块

对于低版本的matlab(15a之前的)要取消勾选limit data points to last,不然导出来的数据最多只有100个
在Simulation>Configuration Parameters

在变量空间就可以看到tout和yout的变量,这样就可以对数据进行处理了

for example:
figure
plot(yout(:,1),yout(:,2),'k')
xlabel \Psi(\alpha)/Wb
ylabel \Psi(\beta)/Wb
xlim([-0.03 0.03])
ylim([-0.03 0.03])
set(gcf,'color','w')

方法2:通过To Workspace模块


simout这个变量会直接保存在变量区,对于simout这个变量有4种格式
- “
Timeseries
”(默认值) 将信号另存为 MATLAB timeseries 对象的结构体

调用方法: plot(simout.Time,simout.Data)
- “
Array
” 就一个输出的数组,类似yout,没有时间信息

调用方法:plot(simout)
- “
Structure
” 这个就只有value,没时间信息, 调用方法:plot(simout.signals.values) - “
Structure With Time
”

调用方法:plot(simout.time,simout.signals.values)