Bode different phase issue
6 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Star Strider
on 21 Oct 2022
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
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)));
.
0 Comments
See Also
Categories
Find more on Get Started with Control System Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!