Hello all, I'm trying to plot a vector of voltage versus voltage (using the 'plot' command), but I'm...
e
Hello all, I'm trying to plot a vector of voltage versus voltage (using the 'plot' command), but I'm still using just 19 points. The plotting is correct, but when I try to use more points in order to get a more refined graphics, the NGspice is plotting the points of one vector versus the points of the other, which means a straight line (wrong result). Does NGSpice have a maximum number of points allowed for a vector? Is there any way to plot vectors with more points? Thank you in advance.
👍 1
a
@Estevao Teixeira Could you share the plotting commands? Also, my advice, use raw output and Python for plotting.
e
@Amro Tork, my plotting is something unusual, because I'm plotting the .AC response (for just one frequency) for each value of voltage applied at the differential pair of an OTA, in order to evaluate the transconductance. I tnink I cannot generate a .raw file. Is it possible?
here is the code
I'm varying the DC voltage from -0.9 to 0.9 Volta, in increments of 0.1 V. When I try to change the increment to 0.01 and the number of points to 181, the result crashes.
a
Copy code
.control
set filetype=ascii
set wr_singlescale
set wr_vecnames
set appendwrite

let Vstart=-0.9
let Vstop=0.9
let Vminus=0.9
let Vplus=0.9 
let delta_v=0.1
let Vplus_act = Vstart
let Vminus_act = Vstop
let index=0

while Vplus_act le Vstop
	alter V5 Vplus_act
	alter V12 Vminus_act
	run
	let magnitude=mag(i(VCM))
    wrdata data.tsv Vplus_act Vminus_act magnitude
    reset
    let Vplus_act=Vplus_act+delta_v
	let Vminus_act=Vminus_act-delta_v
	let index=index+1
end	
.endc
"
You will need to read
data.tsv
into either python or excel for plotting.
Test this out and let me know.
e
Sorry, but I need to understand: is this file data.tsv generated by NGSpice automatically?
a
yes
But, please make sure to delete it every time before running ngspice as it will append on it.
e
I am using the NGSpice in a containe. Maybe due to this I cannot find the file
a
You might need to add a writable path in the container run. And give that path to the wrdata
e
Could you give me an example of code for this, please?
@Amro Tork I found an interesting solution, by using wrdata and set appendwrite. Here is the code
code_temp.txt
a
That's great
Sorry, I was working on something.
e
Thank you for the help.
a
@Estevao Teixeira Anytime
e
After all, I found the code of the solution you sent me, which is similar.