Bode Diagram

18 ビュー (過去 30 日間)
Amir
Amir 2011 年 4 月 27 日
コメント済み: Walter Roberson 2024 年 10 月 15 日
When I plot a bode diagram from a FRD sys (obtained by a measurement data), I encounter phases beyond [-180,180]; actually, their order is about 2000 degrees! What should I do in order to have them inside [-180,180] degree?

採用された回答

Arkadiy Turevskiy
Arkadiy Turevskiy 2011 年 4 月 27 日
You need to use bodeoptions command and set PhaseWrapping to on. Here is an example showing how to do it:
>>s=tf('s'); %define Laplace variable
>>freq=logspace(-1,2,1000); %define frequency vector
>>sys=1/(s^3+2*s^2+3*s+1); %some tf with phase <-180
>>bode(sys,freq) %phase is not within -180:180
>>p=bodeoptions
>>p.PhaseWrapping='on'
>>bode(sys,freq,p) %phase is wrapped inside -180:180
HTH, Arkadiy
  1 件のコメント
Amir
Amir 2011 年 4 月 28 日
Thank you very much. It worked for me :)

サインインしてコメントする。

その他の回答 (2 件)

Benjamin Hoepfner
Benjamin Hoepfner 2022 年 6 月 29 日
Hi,
i'm using version 2021a and i have a similar problem but the previous answer doesn't work in my case. I need the values of the bode(sys) function for further calculations or external data storage. But the phase wrap obviously doesn't work in this case.
Here is my Code:
%same system from the previous answer
s=tf('s');
freq=logspace(-1,2,1000);
sys=1/(s^3+2*s^2+3*s+1);
[M1,P1,w1] = bode(sys,freq); %saving the magnitude,phase and frequency from the system via bode(sys)
X1=[]; %saving the datas in an extra variable
X1(:,1)=w1;
X1(:,2)=M1;
X1(:,3)=P1;
p=bodeoptions;
p.PhaseWrapping='on';
[M2,P2,w2] = bode(sys,freq,p); %same step as before but with the phase wrap option from bodeoptions
X2=[];
X2(:,1)=w2;
X2(:,2)=M2;
X2(:,3)=P2;
figure(1)
semilogx(X1(:,1),X1(:,3),X2(:,1),X2(:,3)) %plotting phases from X1 and X2 over frequency
legend %two curves with same datas..
Is there anybody out there how can help me with this or can give me an explanation for this?
Best regards!
Ben

SRIMATHI
SRIMATHI 2024 年 10 月 15 日
編集済み: Walter Roberson 2024 年 10 月 15 日
same system from the previous answer
s=tf('s');
freq=logspace(-1,2,1000);
sys=1/(s^3+2*s^2+3*s+1);
[M1,P1,w1] = bode(sys,freq);
X1=[];
X1(:,1)=w1;
X1(:,2)=M1;
X1(:,3)=P1;
if true
% code
end
p=bodeoptions;
p.PhaseWrapping='on';
[M2,P2,w2] = bode(sys,freq,p);
X2=[];
X2(:,1)=W2;
X2(:,2)=M2;
X2(:,3)=P2;
figure(1)
semilogx(X1(:,1),X1(:,3),X2(:,1),X2(:,3)) ;
  1 件のコメント
Walter Roberson
Walter Roberson 2024 年 10 月 15 日
W2 is undefined.
MATLAB is case-sensitive. w2 is not the same as W2

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeTime and Frequency Domain Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by