Csv gnuplot“读取0点,无需拟合数据”

Csv gnuplot“读取0点,无需拟合数据”,csv,gnuplot,using,Csv,Gnuplot,Using,全部, 我是gnuplot的新手,我只是想从下面的maxim应用说明5141链接中收集一个模型: 我可以通过wp1、wz1、wp2、wz2、wp3、wz3、wp4、wz4、wp5、wz5、wp6使用10**$1:2将其简化为fit f6x‘droop.csv’命令。但是,我无法越过这一行,因为读取0点时出现错误,没有需要拟合的数据。我可以很好地绘制数据,但我不能适应命令的现状。我认为这与使用修饰语有关。有人能帮我解决这个问题吗 # GNUPLOT File that: #1) Calculate

全部,

我是gnuplot的新手,我只是想从下面的maxim应用说明5141链接中收集一个模型:

我可以通过wp1、wz1、wp2、wz2、wp3、wz3、wp4、wz4、wp5、wz5、wp6使用10**$1:2将其简化为fit f6x‘droop.csv’命令。但是,我无法越过这一行,因为读取0点时出现错误,没有需要拟合的数据。我可以很好地绘制数据,但我不能适应命令的现状。我认为这与使用修饰语有关。有人能帮我解决这个问题吗

# GNUPLOT File that:
#1) Calculates the frequency response after calculating the skin 
effect and dielectric effects,
# using only the physical parameters of the cable. 
#2) It then plots the frequency response caused by these physical 
parameters and stores that
# information in a file called droop.csv.
#3) We then define a pole/zero and pole response, based on frequency, 
the pole, and the zero.
#4) We cascade five pole/zeroes and one pole.
#5) We then calculate the six poles (wp1 to wp6) and the five zeroes 
(wz1 to wz2) using the
# GNUPLOT "Fit" function.
#6) We then calculate a SPICE-equivalent schematic with Rs and Cs 
defined by the poles and zeroes.
#7) We plot the calculated physical response and overlay that with the 
mathematically calculated
# fit, based on a 6 pole/5 pole fit.
#8) The Rs and Cs are passed onto a SPICE high-level schematic, and 
this 
models the cable. This
# schematic can then run AC or transient simulations.
#9) Lastly, we run the SPICE model and obtain the response and compare 
this to the physical
# response and the mathematical response. All three responses must lie 
on top of one another to
# ensure a good model fit.

# Frequencies of interest
fmin = 1e+6 # minimum frequency (Hz)
fmax = 1e9 # maximum frequency (Hz)

# Physical constants
u=1.26e-6 # magnetic permeability (H/m)
c=300e+6 # speed of light (m/s)

# Line-specific constants for cable
sigma=58e+6 # copper conductivity (S/m)
z0=50 # characteristic impedance (Ohms)
er=2.3 # relative dielectric constant RG58U cable (solid Polyethylene)
tand=0.00035 # loss tangent/dissipation factor (polyethylene)
w=2*pi*4.5*10-4 # cross-sectional cable width (m)
#l is line length (m)
l=30


# Attenuation constants
a1=(l/(2*w*z0))*sqrt(pi*u/sigma) # skin effect. Same as Equation 6. 
a2=(l*pi*tand*sqrt(er))/c # Dielectric Effect. Same as Equation 7. 

print "a1=", a1
print "a2=", a2

# Plot the loss including skin and dielectric effects
plot [f=fmin:fmax] exp(-a1*sqrt(f)-a2*f) # Plotting Equation 8.

set table
set logscale x
set output 'droop.csv'
set title "Cable Response via Physical Descripton vs Mathematical Fit"
set xlabel "Frequency"; set ylabel "Amplitude (v)"
set xrange [1e6:1e9]

#Setup for plotting to terminal
replot 
set term x11
set output

fscale=1e9

# Define pole zero and pole equations
# pole/zero
pz(x,p,z)=(1+((2*pi*x)/(2*pi*z))**2)/(1+((2*pi*x)/(2*pi*p))**2) 
# pole
p(x,p)=1/(1+((2*pi*x)/(2*pi*p))**2) # Eq2


# 6-pole fit - cascading 6 pole/zero and one pole utilizing pz(x.p.z) 
and p(x,p). Where x is the frequency.

f6(x)=sqrt(pz(x,wp1,wz1)*pz(x,wp2,wz2)*pz(x,wp3,wz3)*pz(x,wp4,wz4)*
pz(x,wp5,wz5)*p(x,wp6))

# Define our initial estimates
wp1=7e-3*fscale; wz1=8e-3*fscale; wp2=6e-2*fscale; wz2=7e-2*fscale; 
wp3=2.5e-1*fscale; wz3=3.5e-1*fscale; 
wp4=.25*fscale; wz4=0.1*fscale; wp5=.5*fscale; wz5=1*fscale; 
wp6=12*fscale
# Call GNUPLOT's "fit" function to calculate poles and zeroes by least 
square method
fit f6(x) 'droop.csv' using (10**$1):2 via wp1, wz1, wp2, wz2, wp3, 
wz3, wp4, wz4, wp5, wz5, wp6
#Overlay the Cable Characteristics vs the Mathematical Fit.
plot 'droop.csv' using (10**$1):2, f6(x)


#Calculate Rs and Cs for pole/zero schematic normalized for a 50 ohm 
characteristic impedance.

#Pole Zero1
r1= 50*((wz1/wp1)-1);c1=1/(2*pi*50*wz1)
#Pole Zero2
r2= 50*((wz2/wp2)-1);c2=1/(2*pi*50*wz2)
#Pole Zero3
r3= 50*((wz3/wp3)-1);c3=1/(2*pi*50*wz3)
#Pole Zero4
r4= 50*((wz4/wp4)-1);c4=1/(2*pi*50*wz4)
#Pole Zero1
r5= 50*((wz5/wp5)-1);c5=1/(2*pi*50*wz5)
#Last Pole
c6=1/(2*pi*50*wp6)



print "r1=",r1;print "c1=",c1
print "r2=",r2;print "c2=",c2
print "r3=",r3;print "c3=",c3
print "r4=",r4;print "c4=",c4
print "r5=",r5;print "c5=",c5
print "c6=",c6






pause -1 'Hit return to continue'

您的代码生成文件droop.csv,如下所示:

# Curve 0 of 1, 100 points
# Curve title: "exp(-a1*sqrt(f)-a2*f)"
# x y type
 1e+06  0.999833  i
 1.07227e+06  0.999821  i
 1.14976e+06  0.999808  i
 1.23285e+06  0.999794  i
 1.32194e+06  0.999779  i
请注意,第一列中的值从一百万开始,增加到十亿。您尝试用命令拟合此数据

fit f6(x) 'droop.csv' using (10**$1):2 via wp1, wz1, wp2, wz2, wp3, wz3, wp4, wz4, wp5, wz5, wp6
您的using命令尝试将10计算为第一列中任何内容的幂。我怀疑gnuplot能否处理像10^10^6这样的数字。此外,由于xrange先前设置为[1e6:1e9],因此任何数据点都不会在该范围内