使用一个零极点和两个极点进行简单的传递函数,然后绘制其零极点映射:
import control
import matplotlib.pyplot as plt
tfx = control.tf([1,1],[1,1,1])
control.matlab.pzmap(tfx)
plt.show()
结果:Python显示两个极但没有零的图(python 3.6)。 通过以下两个小修改重新执行上述操作:
import control
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.style.use('classic')
tfx = control.tf([1,1],[1,1,1])
control.matlab.pzmap(tfx)
plt.show()
结果:Python显示两个极点和一个零点的图。 我的诊断:matplotlib默认绘图设置不显示圆圈标记' o'。 我的问题:我想使用matplotlib默认情节设置(因为它很漂亮)。我不想使用经典'设置。如何更改默认设置以显示圆形标记?这是我尝试过的:
mpl.rcParams['patch.force_edgecolor'] = True
mpl.rcParams['patch.edgecolor'] = 'k'
mpl.rcParams['boxplot.flierprops.markeredgecolor'] = 'k'
但它并没有改变结果。有什么想法吗?
第二个相关问题:根据document on control module,control.pzmap(tfx)而不是control.matlab.pzmap(tfx)应该制作零极点图。然而,这将导致一个'模块不可调用'错误。奇...
答案 0 :(得分:0)
在pzmap.py的第81行,您会找到
pl.2
这里facecolor被硬编码为import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { ModalComponent } from './modal/modal.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent,
ModalComponent
],
}).compileComponents();
}));
});
。因此,它无助于外部更改rcParams。而是从该行中删除 if len(zeros) > 0:
plt.scatter(real(zeros), imag(zeros), s=50, marker='o',
facecolors='none')
参数,使其看起来像
'none'