bode() magnitude
조회 수: 54 (최근 30일)
이전 댓글 표시
Hi, I Have seen the code [ mag,phase] = bode(sy s) but when i try to see the values of mag, or phase, it returns something like mag(:,:,1). What is the significance of the stuff in the brackets? How can i just get the magnitude values with respect to frequency so I can plot a 2d plot of the magnitude and frequency?
thanks
댓글 수: 0
채택된 답변
Arkadiy Turevskiy
2012년 5월 2일
Magnitude and phase outputs of bode are 3-D arrays, for representing multi-input multi-output systems. The first two dimensions correspond to the number of inputs and outputs, the third dimension corresponds to the number of frequency points. In your case you have a single-input single-output system, so size(mag) is 1 1 n, where n is the number of frequency points.
To get a standard bode plot you can just do
bode(sys)
If you want access to mag and phase as regular vectors, just do
mag=squeeze(mag)
Arkadiy
댓글 수: 0
추가 답변 (4개)
Arkadiy Turevskiy
2012년 5월 2일
semilogx(wout,20*log10(squeeze(mag)))
gives you the same plot for magnitude as bode.
If it does not look the same, it is because the axes limits do not line up. You can customize that and other plot parameters to your liking as described here.
댓글 수: 0
aaa
2012년 5월 2일
댓글 수: 1
Arkadiy Turevskiy
2012년 5월 3일
win=logspace(wout(1),wout(45),100);
% replace 100 with desired number of points
[mag,phase] = bode(sys,win);
참고 항목
카테고리
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!