# How can I fix the error that produces this peak in Bode plot?

7 messages
Open this post in threaded view
|

## How can I fix the error that produces this peak in Bode plot?

 Hi, I am plotting a Bode diagram of a simple resonant control function for a RL load and there is a 'sharp peak' around the target frequency on both the magnitude and the phase diagrams. This sharp peak should not appear and without it, the bode plot would be correct. Could you please give me an intuition on where the problem is? I know that it has nothing to do with the kp_1 and ki_1 parameters, since this peak appears for the complete range of them. I think there is something wrong on how Matlab treats some integrators but I am not sure. Here is my code:  Ub=400/sqrt(3); Ib=3.3;% w_b=2*pi*50; Zbase=(Ub)^2/(sqrt(3)*Ub*Ib); Lbase=Zbase/w_b; Td=0.00015; Rf=0.1; Lf=0.0018; R=Rf/Zbase; L=Lf/Lbase; w=2*pi*50; kp_1=2*pi*1000*Lf; ki_1=(Rf/Lf)*kp_1; s=tf('s'); G_pwm=(1-(Td/2)*s)/(1+(Td/2)*s);  G_i_1=kp_1+ki_1*s/(s^2+w^2); sys_1_vd=(G_i_1*G_pwm)^2/((L*s+R+G_i_1*G_pwm)*(G_i_1*G_pwm+L*s+R-(1-G_i_1)*G_pwm)); bode(sys_1_vd,'r'); grid on; -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: How can I fix the error that produces this peak in Bode plot?

 On Wed, Oct 14, 2020 at 7:02 AM Beginner1 via Help-octave <[hidden email]> wrote:Hi, I am plotting a Bode diagram of a simple resonant control function for a RL load and there is a 'sharp peak' around the target frequency on both the magnitude and the phase diagrams. This sharp peak should not appear and without it, the bode plot would be correct. Could you please give me an intuition on where the problem is? I know that it has nothing to do with the kp_1 and ki_1 parameters, since this peak appears for the complete range of them. I think there is something wrong on how Matlab treats some integrators but I am not sure. Here is my code:  Ub=400/sqrt(3); Ib=3.3;% w_b=2*pi*50; Zbase=(Ub)^2/(sqrt(3)*Ub*Ib); Lbase=Zbase/w_b; Td=0.00015; Rf=0.1; Lf=0.0018; R=Rf/Zbase; L=Lf/Lbase; w=2*pi*50; kp_1=2*pi*1000*Lf; ki_1=(Rf/Lf)*kp_1; s=tf('s'); G_pwm=(1-(Td/2)*s)/(1+(Td/2)*s);  G_i_1=kp_1+ki_1*s/(s^2+w^2); sys_1_vd=(G_i_1*G_pwm)^2/((L*s+R+G_i_1*G_pwm)*(G_i_1*G_pwm+L*s+R-(1-G_i_1)*G_pwm)); bode(sys_1_vd,'r'); grid on; -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html First ---->  this is not a matlab group.second :   did you know that you have a zero at +13333.33?use the rlocus(sys) command to see.-- DAS
Open this post in threaded view
|

## Re: How can I fix the error that produces this peak in Bode plot?

 Thank you for the answer. Yes, I know that this is not a Matlab group, but I was trying also in Matlab. And by error I put Matlab in the description, but the code also runs in octave. I tried to edit the post to change this, but seems that it cannot be edited once posted. -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: How can I fix the error that produces this peak in Bode plot?

 In reply to this post by Doug Stewart-4 With regard to that zero at +13333.33, I am not familiar with rlocus, but I have plotted it without finding this zero at +13333 in the plot that would make the system unstable I guess, if located on the right side of the plane. Attached I send the plot. Anyway, I also wrote the command [r,k] = rlocus(sys_1_vd), to see the exact numerical value of the roots, but did not find any +13333.33 location. On the other hand,  by obtaining the eigenvalues of the system, they all have negative real part, except for 2 with a very small positive real part, which it may be due to inaccuracies of the calculation. But I think, this has no relationship with the zero you have pointed out to be located at +13333.33.  -757.69960 +    0.00000i   -1487.09047 +    0.00000i     -28.89898 +  318.89945i     -28.89898 -  318.89945i     -25.27902 +  323.48505i     -25.27902 -  323.48505i      -0.00207 +  314.16966i      -0.00207 -  314.16966i       0.01004 +  314.15586i       0.01004 -  314.15586i      -0.00797 +  314.15227i      -0.00797 -  314.15227i How can I see this zero at +13333.33? -- Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
Open this post in threaded view
|

## Re: How can I fix the error that produces this peak in Bode plot?

 On Wed, Oct 14, 2020 at 8:11 AM Beginner1 via Help-octave <[hidden email]> wrote: With regard to that zero at +13333.33, I am not familiar with rlocus, but I have plotted it without finding this zero at +13333 in the plot that would make the system unstable I guess, if located on the right side of the plane. Attached I send the plot. Anyway, I also wrote the command [r,k] = rlocus(sys_1_vd), to see the exact numerical value of the roots, but did not find any +13333.33 location. On the other hand,  by obtaining the eigenvalues of the system, they all have negative real part, except for 2 with a very small positive real part, which it may be due to inaccuracies of the calculation. But I think, this has no relationship with the zero you have pointed out to be located at +13333.33.  -757.69960 +    0.00000i   -1487.09047 +    0.00000i     -28.89898 +  318.89945i     -28.89898 -  318.89945i     -25.27902 +  323.48505i     -25.27902 -  323.48505i      -0.00207 +  314.16966i      -0.00207 -  314.16966i       0.01004 +  314.15586i       0.01004 -  314.15586i      -0.00797 +  314.15227i      -0.00797 -  314.15227i How can I see this zero at +13333.33? [num,den]=tfdata(sys_1_vd,'v')roots(num)This will convert your transfer function  to num/den form then looks at the roots of the numerator.  -- DAS