matlab - 在 MATLAB 中为波特图定义传递函数的问题
问题描述
我正在尝试使用 Matlab 调整 PID 控制器(不是 Simulink,因为我正在学习/uni 课程)。 1、总结问题:
- 所以,我有一个需要满足相位裕度要求的系统的传递函数
- 为了找到 PID 的相位超前部分,我需要求解一堆方程以使用计算的变量绘制波特图
2.描述我尝试过的
- 我试图
tf([num],[den])
用实数替换 ,但这是不可行的,因为它违背了这样做的目的,我希望 Matlab 计算 GR 和频率并将其代入 tf
问题
Full_Code: https ://drive.google.com/file/d/1sWUnvvye_RBXGL8-nWq___3F5UDmDOoG/view?usp=sharing
最小可重现代码示例:
clearvars;clc;clearAllMemoizedCaches;clear
syms s w
%--------------TF of the aircraft
G(s)= (160*(s+2.5)*(s+0.7))/((s^2+5*s+40)*(s^2+0.03*s+0.06));
k= 8; % selected k value range 4<k<8
Max_PA=asind((k-1)/(k+1)); % computes max phase advance
Centre_dB= 20*log10(sqrt(k)); % computing centre gain in dB
Poi= -120-Max_PA % looking for Point of interest(Poi)
tf_int= subs(G(s),1j*w); %intermediate transfer function
eqn= atan2d(imag(tf_int),real(tf_int))==Poi; % solve for w at Poi
% computing crossover freq(wc)
wc= vpasolve(eqn,w); % find exactly the wc at Poi
GR=20*log10(abs(subs(tf_int,w,wc))); % find the gain at at wc
Kpa= 10^((GR-Centre_dB)/20);
ti= 1/(sqrt(k)*wc); % computing Kpa and ti
num1= [Kpa*k*ti,Kpa];
den2= [ti,1];
PA= tf(num1,den2) %PA tf defined
解决方案
Yo 正在尝试将非数字(符号数字)值输入tf
,它只接受数字数组。您可以将它们转换为double()
PA= tf(double(num1),double(den2)) %PA tf defined
推荐阅读
- python - 格式 24 小时查询 sqlite3
- python - python AttributeError:'mHID'对象没有属性'dict'
- angular-cli - @angular/cli 的选项路径是什么?
- c# - 既然我们有多播委托,为什么我们需要事件?
- javascript - 试图确定图像元素的可见部分(jQuery)
- utf-8 - 这些表情符号是有效的 UTF-8 吗?
- python - 如何顺序组合2个tensorflow模型?
- javascript - 使用 webpack 加载噩梦时出错
- c - C中调用结构的动态方法
- powershell - 如何从 RStudio 终端进行 SSH 登录