绘制测量数据以及波德图

时间:2015-10-01 23:24:01

标签: matlab plot

我正在参加电路课程,对于实验室我们需要用MATLAB做一些工作来绘制一些结果。我得到了以下代码,我用它来生成我们正在设计的滤波器的传递函数的波特图。我有点了解它是如何工作的,但我并不是真正了解或使用本课程以外的MATLAB。

 Result result = db.execute(MATCH (a:user), (b:user) WHERE a.ID='1' AND b.ID='7' Merge (a)-[: friend]->(b) return a, b)

这很好但现在我需要绘制我在实验室测量的传递函数与SAME绘图轴上的数据。我怎样才能将它们一起绘制出来。我将实验室数据作为增益频率对列表。

1 个答案:

答案 0 :(得分:1)

而不是bode(H),请尝试:

[mag,ph,w] = bode(H); % gets the data without generating the figure
plot(w, mag, 'b'); % plots only the magnitudes

freqs = data(:,1); % These 2 lines depend on how your data is formatted
gains = data(:,2); % These 2 lines depend on how your data is formatted

hold on % will add new content to the existing figure without erasing the previous content
plot(freqs, gains, 'r');
hold off 

您也可以尝试(受http://www.mathworks.com/help/ident/ref/bodeplot.html启发):

h = bodeplot(H);
setoptions(h,'FreqUnits','Hz','PhaseVisible','off'); % suppress the phase plot


freqs = data(:,1); % These 2 lines depend on how your data is formatted
gains = data(:,2); % These 2 lines depend on how your data is formatted

hold on % will add new content to the existing figure without erasing the previous content
plot(freqs, gains, 'r');
hold off 
相关问题