【发布时间】:2017-12-10 02:00:50
【问题描述】:
全部,
我是 gnuplot 的新手,真的只是想从 maxim 的应用说明 5141(下面的链接)中收集一个模型:
https://www.maximintegrated.com/en/app-notes/index.mvp/id/5141
我可以通过 wp1、wz1、wp2、wz2、wp3、wz3、wp4、wz4、wp5 使用 (10**$1):2 将其归结为命令“fit f6(x) 'droop.csv' wz5、wp6”。但是我无法越过这条线,因为出现错误“读取 0 点没有适合的数据”。我可以很好地绘制数据,但我无法适应命令。我认为这与 using 修饰符有关。谁能帮我解决这个问题?
# 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'
【问题讨论】: