文章目录
- Matlab 仿真——直流电机速度控制(2)系统分析
- 0. 被控对象与设计要求
- 1. 开环响应
- 2. LTI 模型特征
- 3. 其他输入信号的响应
- 4. 引用
Matlab 仿真——直流电机速度控制(2)系统分析
上一节我们成功在matlab建立好了电机系统模型,这一节我们来分析这个系统的时域响应
0. 被控对象与设计要求
这里把设计需求和系统转换方程粘贴在这里: 设计需求(阶跃响应):
- 稳定时间<2s
- 超调<5%
- 稳态误差<1%
转换方程:
1. 开环响应
让我们看看该系统的开环响应如何,是否满足我们对电机的要求。matlab自带了线性系统分析工具。 Matlab运行以下代码
<code class="prism language-python has-numbering"><span class="token operator">%</span>motor parameter J <span class="token operator">=</span> <span class="token number">0.01</span><span class="token punctuation">;</span> b <span class="token operator">=</span> <span class="token number">0.1</span><span class="token punctuation">;</span> K <span class="token operator">=</span> <span class="token number">0.01</span><span class="token punctuation">;</span> R <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span> L <span class="token operator">=</span> <span class="token number">0.5</span><span class="token punctuation">;</span> <span class="token operator">%</span>motor tf function s <span class="token operator">=</span> tf<span class="token punctuation">(</span><span class="token string">'s'</span><span class="token punctuation">)</span><span class="token punctuation">;</span> P_motor <span class="token operator">=</span> K<span class="token operator">/</span><span class="token punctuation">(</span><span class="token punctuation">(</span>J<span class="token operator">*</span>s<span class="token operator">+</span>b<span class="token punctuation">)</span><span class="token operator">*</span><span class="token punctuation">(</span>L<span class="token operator">*</span>s<span class="token operator">+</span>R<span class="token punctuation">)</span><span class="token operator">+</span>K<span class="token operator">^</span><span class="token number">2</span><span class="token punctuation">)</span> <span class="token operator">%</span>求系统P_motor的阶跃响应,时间为<span class="token number">0</span>到<span class="token number">5</span>秒,步长<span class="token number">0.</span>1s linearSystemAnalyzer<span class="token punctuation">(</span><span class="token string">'step'</span><span class="token punctuation">,</span>P_motor<span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">:</span><span class="token number">0.1</span><span class="token punctuation">:</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span> </code>
输出
在窗口上右击选择要显示的数据,我们得到系统的稳定时间为2.07秒,终值为0.0999。稳定时间不满足我们的要求。
2. LTI 模型特征
我们选择该系统的零极点图来观察
发现该系统有两个实极点,一个在-2处, 一个在-10处。也因为极点没有虚部,所以系统不存在震荡。根据现代控制系统的知识,我们推测-2处的极点主导了系统的响应。为了验证这个想法,我们找到一个单极点的系统进行比较
rP_motor = 0.1/(0.5*s+1)
。 代码如下
<code class="prism language-csharp has-numbering"><span class="token operator">%</span>motor parameter J <span class="token operator">=</span> <span class="token number">0.01</span><span class="token punctuation">;</span> b <span class="token operator">=</span> <span class="token number">0.1</span><span class="token punctuation">;</span> K <span class="token operator">=</span> <span class="token number">0.01</span><span class="token punctuation">;</span> R <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">;</span> L <span class="token operator">=</span> <span class="token number">0.5</span><span class="token punctuation">;</span> <span class="token operator">%</span>motor tf function s <span class="token operator">=</span> <span class="token function">tf</span><span class="token punctuation">(</span><span class="token string">'s'</span><span class="token punctuation">)</span><span class="token punctuation">;</span> P_motor <span class="token operator">=</span> K<span class="token operator">/</span><span class="token punctuation">(</span><span class="token punctuation">(</span>J<span class="token operator">*</span>s<span class="token operator">+</span>b<span class="token punctuation">)</span><span class="token operator">*</span><span class="token punctuation">(</span>L<span class="token operator">*</span>s<span class="token operator">+</span>R<span class="token punctuation">)</span><span class="token operator">+</span>K<span class="token operator">^</span><span class="token number">2</span><span class="token punctuation">)</span> rP_motor <span class="token operator">=</span> <span class="token number">0.1</span><span class="token operator">/</span><span class="token punctuation">(</span><span class="token number">0.5</span><span class="token operator">*</span>s<span class="token operator">+</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token operator">%</span>求系统P_motor的阶跃响应,时间为<span class="token number">0</span>到<span class="token number">5</span>秒,步长<span class="token number">0.1</span>s <span class="token function">linearSystemAnalyzer</span><span class="token punctuation">(</span><span class="token string">'step'</span><span class="token punctuation">,</span>P_motor<span class="token punctuation">,</span><span class="token number">0</span><span class="token punctuation">:</span><span class="token number">0.1</span><span class="token punctuation">:</span><span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">;</span> </code>
在弹出的窗口里面我们导入新的系统阶跃响应
可以发现系统阶跃响应很接近,这印证了我们的猜想。
3. 其他输入信号的响应
除了阶跃响应,有时我们也想看看系统输入为其他输入信号时的情况。你可以直接导入你自己定义好的输入信号,或者用Matlab为你准备好的信号模板定制输入信号。接下来我们演示如何用模板信号。 右击,选择Plot Types——Linear Simulation
定义仿真时间,步长,然后点击设计信号
填写信号参数,插入,然后点击仿真
- 接着你就能看到新的输入型号的输出结果了
4. 引用