Gnuplot限制在一个绘图上绘制多个数据文件的域

Gnuplot限制在一个绘图上绘制多个数据文件的域,plot,gnuplot,xrange,Plot,Gnuplot,Xrange,我正在使用我编写的.plt文件访问来自许多不同文件的数据。每个数据集只有一个特定的域是重要的。我试图将每个数据集的特定域绘制到一个图形上 每个域中的数据对应一个峰值。我想画出每一个峰,然后用指数衰减函数拟合这些峰 以下是我的打印文件中的代码: set xlabel "Time (ms)" set ylabel "voltage" set title "T1 time for Isopropyl Alcohol" dir='C:\Users\Daniel\Desktop\College\mode

我正在使用我编写的.plt文件访问来自许多不同文件的数据。每个数据集只有一个特定的域是重要的。我试图将每个数据集的特定域绘制到一个图形上

每个域中的数据对应一个峰值。我想画出每一个峰,然后用指数衰减函数拟合这些峰

以下是我的打印文件中的代码:

set xlabel "Time (ms)"
set ylabel "voltage"

set title "T1 time for Isopropyl Alcohol"
dir='C:\Users\Daniel\Desktop\College\modern lab\gp501-win64-mingw\gnuplot\bin\data files\isoproply_alc_t1\'
unset key
set style data linespoints
x(v, left, right) = (v >= left && v <= right ? v : 1/0)
plot dir.'nmr-t1-isopropyl-dt10' using (x($0*0.01, 3, 7)):1, \
     dir.'nmr-t1-isopropyl-dt50' using (x($0*0.01, 20, 40)):1, \
     dir.'nmr-t1-isopropyl-dt100' using (x($0*0.01, 40, 60)):1, \
     dir.'nmr-t1-isopropyl-dt150' using (x($0*0.01, 70, 80)):1, \
     dir.'nmr-t1-isopropyl-dt200' using (x($0*0.01, 99, 101)):1, \
     dir.'nmr-t1-isopropyl-dt230' using (x($0*0.01, 114, 116)):1, \
     dir.'nmr-t1-isopropyl-dt250' using (x($0*0.01, 124, 126)):1, \
     dir.'nmr-t1-isopropyl-dt270' using (x($0*0.01, 134, 136)):1, \
     dir.'nmr-t1-isopropyl-dt290' using (x($0*0.01, 144, 146)):1, \
     dir.'nmr-t1-isopropyl-dt300' using (x($0*0.01, 149, 151)):1, \
     dir.'nmr-t1-isopropyl-dt320' using (x($0*0.01, 159, 161)):1, \
     dir.'nmr-t1-isopropyl-dt340' using (x($0*0.01, 169, 171)):1, \
     dir.'nmr-t1-isopropyl-dt360' using (x($0*0.01, 178, 183)):1, \
     dir.'nmr-t1-isopropyl-dt400' using (x($0*0.01, 198, 201)):1, \
     dir.'nmr-t1-isopropyl-dt430' using (x($0*0.01, 213, 217)):1, \
     dir.'nmr-t1-isopropyl-dt470' using (x($0*0.01, 233, 236)):1, \
     dir.'nmr-t1-isopropyl-dt580' using (x($0*0.01, 289, 291)):1, \
     dir.'nmr-t1-isopropyl-dt620' using (x($0*0.01, 309, 311)):1, \
     dir.'nmr-t1-isopropyl-dt650' using (x($0*0.01, 324, 326)):1, \
     dir.'nmr-t1-isopropyl-dt700' using (x($0*0.01, 348, 352)):1, \
     dir.'nmr-t1-isopropyl-dt750' using (x($0*0.01, 374, 376)):1, \
     dir.'nmr-t1-isopropyl-dt800' using (x($0*0.01, 399, 401)):1, \
     dir.'nmr-t1-isopropyl-dt850' using (x($0*0.01, 424, 426)):1, \
     dir.'nmr-t1-isopropyl-dt900.2' using (x($0*0.01, 449.5, 451)):1
设置xlabel“时间(毫秒)”
设置标签“电压”
设置标题“异丙醇的T1时间”
dir='C:\Users\Daniel\Desktop\College\modern lab\gp501-win64-mingw\gnuplot\bin\data files\iproply\u alc\u t1\n
取消设置键
设置样式数据线点

x(v,left,right)=(v>=left&&vGnuplot不支持在单个
plot
命令中为每个数据文件指定单个范围。该命令仅适用于函数

必须使用
语句过滤
中的数据,方法是为所需范围之外的所有点提供值
1/0
,该值将使相应点无效:

left = 3
right = 7
plot 'file.dat' using ($0 > left && $0 < right ? $0 : 1/0):1
  • 使用
    unset key

  • 可以使用
    set style data lines points
    全局设置数据文件的打印样式
  • 所以你的脚本看起来像

    set xlabel "Time (ms)"
    set ylabel "voltage"
    set format y "%s"
    
    set title "T1 time for Isopropyl Alcohol"
    dir='C:\Users\Daniel\Desktop\College\modern lab\gp501-win64-mingw\gnuplot\bin\data files\isoproply_alc_t1\'
    unset key
    set style data linespoints
    x(v, left, right) = (v >= left && v <= right ? v : 1/0
    plot dir.'nmr-t1-isopropyl-dt10' using (x($0*0.01, 3, 7)):1, \
         dir.'nmr-t1-isopropyl-dt50' using (x($0*0.01, 20, 40)):1, \
         dir.'nmr-t1-isopropyl-dt100' using (x($0*0.01, 40, 60)):1, \
         dir.'nmr-t1-isopropyl-dt150' using (x($0*0.01, 70, 80)):1
    
    设置xlabel“时间(毫秒)”
    设置标签“电压”
    设置格式y“%s”
    设置标题“异丙醇的T1时间”
    dir='C:\Users\Daniel\Desktop\College\modern lab\gp501-win64-mingw\gnuplot\bin\data files\iproply\u alc\u t1\n
    取消设置键
    设置样式数据线点
    
    x(v,left,right)=(v>=left&&v,效果非常好!我得到了一个包含所有峰值的清晰曲线图。我应该从哪里开始,以便拟合指数衰减函数来拟合这些峰值?(它应该看起来像一个包含所有数据点的封套。你必须将衰减曲线中的所有点放在一个文件(或内联数据集)中才能使用“拟合”.一行:
    设置表$T1data;replot;unset表;fit I-2*I*exp(-x/T1)$T1data us 1:2 noerr via I,T1
    (我假设反转恢复;-))您可能需要调整每个回波的左右限值,因此
    x()
    只返回一个值。这是反转恢复!谢谢。我在使用gnuplot时仍然遇到问题。我可能会切换回mathematica!与mathematica不同,gnuplot只是一个绘图程序,不用于数据处理。请记住这一点
    set xlabel "Time (ms)"
    set ylabel "voltage"
    set format y "%s"
    
    set title "T1 time for Isopropyl Alcohol"
    dir='C:\Users\Daniel\Desktop\College\modern lab\gp501-win64-mingw\gnuplot\bin\data files\isoproply_alc_t1\'
    unset key
    set style data linespoints
    x(v, left, right) = (v >= left && v <= right ? v : 1/0
    plot dir.'nmr-t1-isopropyl-dt10' using (x($0*0.01, 3, 7)):1, \
         dir.'nmr-t1-isopropyl-dt50' using (x($0*0.01, 20, 40)):1, \
         dir.'nmr-t1-isopropyl-dt100' using (x($0*0.01, 40, 60)):1, \
         dir.'nmr-t1-isopropyl-dt150' using (x($0*0.01, 70, 80)):1