# 在centos中安裝ngspice電路模擬器
## 1. 進入ngspcie[官網](http://ngspice.sourceforge.net/)
## 2. 點選Tutorials

## 3. 點選tutorials for beginners
## 4. 點選Download and Install ngspice(Linux),進入此畫面 
## 5. 下載[ngspice-31.tar.gz](https://sourceforge.net/projects/ngspice/files/ng-spice-rework/31/ngspice-31.tar.gz/download)
## 6. 點2下後即可解壓縮
## 7. 進入解壓後資料夾,右鍵以終端機開啟

## 8. 輸入這個指令(全部複製):
```sudo yum install gcc make readline-devel libXaw-devel && ./configure --with-x --enable-xspice --enable-cider --with-readline=yes --enable-openmp --disable-debug CFLAGS="-m64 -O2" LDFLAGS="-m64 -s" && make -j8 && sudo make install```
## 9. 中途會要求管理員密碼,輸入即可
## 10. 開啟文字編輯器,貼上以下,並存成test.sp檔:
```spcice=
* Simple spice netlist
v1 vdd 0 1.8V
m1 out in vdd vdd pch
m2 out in 0 0 nch
c1 out 0 1f
v2 in 0 pwl 0ps 0 100ps 0 200ps 1.8 500ps 1.8 600ps 0 900ps 0 1100ps 1.8 1400ps 1.8 1600ps 0 1900ps 0 1950ps 1.8 2300ps 1.8 2350ps 0
.model nch nmos
.model pch pmos
.tran 1p 2600p
.end
```
## 11. 找到test.sp的資料夾,右鍵以終端機開啟
## 12. 輸入`ngspice test.sp`
## 13. 輸入`run`
## 14. 輸入`plot v(in) v(out)`
## 15. 成功顯示波形
有任何問題歡迎email : frakwu@gmail.com
###### tags: `ngspice` `centos` `安裝` `教學`