Bode different phase issue

14 次查看(过去 30 天)
Bertug
Bertug 2022-10-21
编辑: Bertug 2022-10-23
Hello,
I have a homework. I have a transfer function which is related to butterworth low pass filter. Teacher asks me phase and amplitude response, and bode diagram separately. I use freqs(num,den) for the phase and amplitude response. I use bode(sys) for the bode diagram. When I compare the outputs, amplitude responses are quite similar. But phase responses are quite different. You can see the outputs and my codes.
Here is my code:
>> wp = 1;
>> ws = 1.2;
>> Rp = 0.2;
>> Rs = 25;
>> [n, Wn] = buttord(wp,ws,Rp,Rs,'s');
>> [num, den] = butter(n, Wn, 's');
>> sys = tf(num, den);
Continuous-time transfer function.
>> bode(sys)
>> freqs(num, den)
bode(sys) output:
freqs(num, den) output:
Is it necessary to see them similar or same? Could you please explain me?
Thanks in advance.

回答(1 个)

Star Strider
Star Strider 2022-10-21
In the freqs call, the phase is wrapped. Unwrap it and freqs matches bode
wp = 1;
ws = 1.2;
Rp = 0.2;
Rs = 25;
[n, Wn] = buttord(wp,ws,Rp,Rs,'s');
[num, den] = butter(n, Wn, 's');
sys = tf(num, den);
sys
sys = 5.373 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- s^25 + 17.03 s^24 + 145.1 s^23 + 821.6 s^22 + 3471 s^21 + 1.164e04 s^20 + 3.215e04 s^19 + 7.51e04 s^18 + 1.509e05 s^17 + 2.639e05 s^16 + 4.054e05 s^15 + 5.504e05 s^14 + 6.626e05 s^13 + 7.087e05 s^12 + 6.734e05 s^11 + 5.675e05 s^10 + 4.225e05 s^9 + 2.763e05 s^8 + 1.574e05 s^7 + 7.708e04 s^6 + 3.191e04 s^5 + 1.089e04 s^4 + 2949 s^3 + 595.6 s^2 + 80 s + 5.373 Continuous-time transfer function.
figure
bode(sys)
figure
freqs(num,den, 1E+2)
Ax2 = get(subplot(2,1,2));
Line = Ax2.Children;
Ax2.Children.YData = rad2deg(unwrap(deg2rad(Line.YData)));
Helpful functions for this are unwrap, deg2rad and rad2deg.
.

类别

Help CenterFile Exchange 中查找有关 Get Started with Control System Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by