首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >gnuplot "Read 0 points No data to fit“

gnuplot "Read 0 points No data to fit“
EN

Stack Overflow用户
提问于 2017-12-10 10:00:50
回答 1查看 931关注 0票数 0

全,

我是新接触gnuplot的,我只是想从maxim的应用笔记5141 (链接如下)中收集一个模型:

https://www.maximintegrated.com/en/app-notes/index.mvp/id/5141

我可以使用(10**$1):2via wp1,wz1,wp2,wz2,wp3,wz3,wp4,wz4,wp5,wz5,wp6命令"fit f6(x) 'droop.csv‘“。但是,我不能越过这条线,因为出现错误"Read 0 points No data to fit“。我可以很好地绘制数据,但是我不能很好地适应命令。我认为这与using修饰语有关。有人能帮我解决这个问题吗?

代码语言:javascript
复制
# 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'
EN

回答 1

Stack Overflow用户

发布于 2017-12-10 14:25:29

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

代码语言:javascript
复制
# 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

请注意,第一列中的值从一百万开始(并增加到十亿)。您可以尝试使用以下命令来拟合此数据

代码语言:javascript
复制
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],所以没有任何数据点会落在该范围内。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47735145

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档