How to plot Specific data points on individual bode plots.

조회 수: 79 (최근 30일)
Arminas Bartkus
Arminas Bartkus 2021년 1월 5일
댓글: Adam Danz 2021년 1월 6일
Hi, so I am analysing a DC motor speed using a PI controller.
Anyway I have collected data for the amplitude ratio of the achieved amplitude against the command amplitude aswell as the time period, time difference between peaks and thus the phase angle in degrees. Here is me defining the data in MATLAB.
Fq = [5 10 50 100 500 1000]; %Command Frequencies
Ar = [0.75472144 0.54075 0.11894 0.054723 0.005801 0.00157]; %Amplitude ratio (Achieved/Command)
Ph_deg = [-2.036864964 -5.388668069 -56.78613362 -68.88060233 -120.9170132 -144.9197795]; %Phase angle (Deg)
Ph_rad = Ph_deg*(pi/180); %Phase angle (Rad)
I have then estimated the transfer function for this system and have plotted a bode plot using:
zfr = Ar.*exp(sqrt(-1)*Ph_rad);
data = frd(zfr, Fq);
nz = 1;
np = 2;
Gc = tfest(data,np,nz);
bode(Gc)
Obviously I have my experimental data from my simulations I.e. the frequencies for x axis and the magnitude in dB that I can calculate from the ratio and the phase angle in degrees I have.
How can I choose which graph (Magnitude or Phase angle) and how can I plot these specific experimental data points onto the bode plots?
I have tried many different solutions but none have come to achieve what I require.

채택된 답변

Adam Danz
Adam Danz 2021년 1월 6일
편집: Adam Danz 2021년 1월 6일
Fq = [5 10 50 100 500 1000]; %Command Frequencies
Ar = [0.75472144 0.54075 0.11894 0.054723 0.005801 0.00157]; %Amplitude ratio (Achieved/Command)
Ph_deg = [-2.036864964 -5.388668069 -56.78613362 -68.88060233 -120.9170132 -144.9197795]; %Phase angle (Deg)
Ph_rad = Ph_deg*(pi/180); %Phase angle (Rad)
zfr = Ar.*exp(sqrt(-1)*Ph_rad);
data = frd(zfr, Fq);
nz = 1;
np = 2;
Gc = tfest(data,np,nz);
bode(Gc)
% Get axis handles
% axh(3) is the upper plot
% axh(2) is the lower plot
% axh(1) is used for labels
axh = findall(gcf, 'type', 'axes');
% Add objects to upper axis
hold(axh(3),'on')
plot(axh(3),Fq, 20*log10(Ar), 'r--','LineWidth',1)
% Add objects to lower axis
hold(axh(2),'on')
plot(axh(2),Fq, Ph_deg, 'r--','LineWidth',1)
Notice that the added lines extend beyond the axis limits. To adjust the axis limits,
set(axh(2:3),'YLimMode','Auto')
  댓글 수: 2
Adam Danz
Adam Danz 2021년 1월 6일
Thanks for providing a concise working example!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Plot Customization에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by