使用ngspice进行电路仿真

电路spice仿真工具已经比较成熟,开源的免费工具也有不错的性能。使用ngspice可以得到不错的仿真结果。

在Linux系统上,例如写一个RLC谐振的电路:

RLC
V1 1 0 AC 1V 
L 1 2 0.2 IC=0
R 3 0 500 
C 2 3 0.1U IC=0
.AC DEC 501 100 10K
.END

命名为rlc.cir。

在终端运行ngspice:

绘图:

带通滤波器:

.title BPF of McHF 80m Band
.option post=3

.ac lin 10000 1 5mega

Vs sig 0 AC 1.0 0

C3 sig net1 100n
L1 net1 0 2.2u
C7 net1 0 1.5n
C11 net1 net2 680n
L5 net2 net3 4.7u
L9 net3 0 2.2u
C15 net3 0 1.5n
C19 net3 out 100n

RL out 0 10mega

.probe v(out)
.plot db(v(out))

.end

原文地址:https://www.cnblogs.com/lyuyangly/p/11924156.html