add points into bode plot - phase and magnitude
조회 수: 42 (최근 30일)
이전 댓글 표시
Hello,
I was asked to add one point in each part of the bode plot. I can plot a point in the phase part, but how can I add a point to the magnitude part?
clear all, close all, clc;
TF=tf([30 0],[1 17 30]);
bode(TF);
hold on;
plot(15,-37.4054,'*');
댓글 수: 0
답변 (1개)
Star Strider
2016년 3월 19일
Add a second argument with a vector of radian frequencies at which you want the bode function to evaluate your system:
[mag,phase] = bode(sys,w);
댓글 수: 2
Star Strider
2016년 3월 19일
편집: Star Strider
2016년 3월 19일
I’m using (and citing the documentation of) R2016a. Again from the documentation:
H = tf([1 0.1 7.5],[1 0.12 9 0 0]);
w = logspace(-1,1,100);
bode(H,w)
This worked for me.
You have to put the angular frequencies you want into the ‘w’ vector. Add those you want to include wherever you want (beginning or end of the ‘w’ vector that covers your frequencies of interest), then use the sort function with the 'ascend' option to put it in the appropriate location in the ’w’ vector. That’s how I always do it.
This works:
H = tf([1 0.1 7.5],[1 0.12 9 0 0]);
w = logspace(-1,1,100);
w = sort([w 0.5], 'ascend'); % Add Point & Sort
wix = find(w == 0.5); % Find Index Of point
[mag,phase] = bode(H,w);
figure(1)
subplot(2,1,1)
loglog(w, squeeze(mag), w(wix), mag(1,1,wix), 'gp')
text(w(wix), mag(1,1,wix), 'Added Point\uparrow', 'HorizontalAlignment','right', 'VerticalAlignment','top')
grid
subplot(2,1,2)
semilogx(w, squeeze(phase), w(wix), phase(1,1,wix), 'gp')
text(w(wix), phase(1,1,wix), 'Added Point\uparrow', 'HorizontalAlignment','right', 'VerticalAlignment','top')
grid

EDIT — Added plot
참고 항목
카테고리
Help Center 및 File Exchange에서 Plot Customization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!