Create bode plot from state space in dB units?

조회 수: 15 (최근 30일)
Thijs
Thijs 2014년 3월 18일
답변: Craig 2014년 3월 18일
Hi everyone,
I have a big SS (1 input, 1 output, 186 states), and I try to create the Bode plot. This all works if I use the following code:
h_bode = bodeoptions;
h_bode.Xlim = [1 2000];
h_bode.FreqUnits = 'Hz';
h_bode.MagUnits = 'abs';
h_bode.MagScale = 'log';
h_bode.PhaseWrapping = 'on';
h_bode.phaseVisible = 'on';
h_bode.Grid = 'on';
wmin = log10(0.001)*2*pi;
wmax = log10(2000)*2*pi;
npoints = 10000;
figure('name','SS Bode Plant P(s)');
w = logspace(wmin,wmax,npoints);
h_bode.MagUnits = 'abs';
bodeplot(P,w,h_bode);
set(findobj('Type','line'),'Linewidth',2)
title('Bode Diagram: Plant P(s) (dp2np)');
However, when I use "
h_bode.MagUnits = 'dB';
it gives the warning 'negative data ignored'.
Do I need to do with the State Space model before giving it as input for 'bodeplot'? Or am I missing something?
Thanks in advance,
Thijs

채택된 답변

Craig
Craig 2014년 3월 18일
The issue is setting the MagScale to log and using dB for units. Any magnitude less than one will be negative in dB and thus can not be shown in log scale axes. I have created a bug report to better handle this case. If you change the MagScale to 'linear' with MagUnits 'dB' should solve the issue you are seeing.

추가 답변 (1개)

Francesco
Francesco 2014년 3월 18일
I was doing something similar but had a lot of problems with the bode function. My advice is to use the bode function to get the magnitude, phase and frequency values and then make your own plot in the units you prefer.

카테고리

Help CenterFile Exchange에서 Frequency-Domain Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by