Mathematica - 动态 - ListPlot - 基线

时间:2012-08-02 09:26:40

标签: wolfram-mathematica

我正在对双态平衡过程的原始数据集执行基线拟合。该过程包括将S形曲线拟合到上下线性基线,并进行减法,以便在x值范围内得到从y =(0)(状态1)到y =(1)(状态2)的曲线而是y =(实验可观察值)。

我想通过交互式动态方法加快基线选择过程,而不是手动输入每条曲线的lhs / rhs x值。但是,我注意到动态图背后的动态值需要在屏幕上才能更新图。意思是,如果我是动态列表绘制4个点,并且这些动态值中只有三个(输出)在屏幕上,那么只有三个显示。我必须向上或向下滚动笔记本以“更新”各种值,然后图表自己纠正。

我在基线选择后下游有很多计算,我希望所有这些后续计算都打印在滑块附近的一个整齐的小网格中,而不必滚动。

我是Dynamic的新手,在动态功能下保存时也很难组合多个图(类似于Show)。我想动态地在一个图形中绘制我的rawData的ListPlot,四个基线点,然后通过基线区域中选定的rawData来拟合线性函数。接下来,我将绘制两态平衡图(y = 0到1),然后是表示50/50 state1 / state2(y = 0.5)的转换点的单个点。所有这些下游过程都高度依赖于基线选择,所以我想在那里使用滑块和最终图来立即看到各种基线选择的结果。

总之,有两个问题: 1)从动态值输出所需的屏幕刷新,用于更新不在同一输入部分中的动态图 2)单个图形中的多个绘图类型,动态

祝你好运, 裴家

ramp1FCelsiusXRFUSmooth[
   1] = {{5.2, 171.5576923076923}, {5.4, 171.4583916083916}, {5.6, 
    171.36804195804197}, {5.8, 171.31552447552448}, {6, 
    171.31125874125877}, {6.2, 171.35321678321677}, {6.4, 
    171.41783216783216}, {6.6, 171.5072027972028}, {6.8, 
    171.61223776223778}, {7, 171.74020979020978}, {7.2, 
    171.8802097902098}, {7.4, 172.01412587412588}, {7.6, 
    172.1367832167832}, {7.8, 172.25818181818184}, {8, 
    172.37916083916082}, {8.2, 172.52223776223775}, {8.4, 
    172.65797202797202}, {8.6, 172.81475524475525}, {8.8, 
    172.97706293706293}, {9, 173.16314685314686}, {9.2, 
    173.35531468531468}, {9.4, 173.56958041958043}, {9.6, 
    173.7951048951049}, {9.8, 174.03153846153847}, {10, 
    174.2748951048951}, {10.2, 174.51762237762236}, {10.4, 
    174.7634265734266}, {10.6, 174.9851048951049}, {10.8, 
    175.1865034965035}, {11, 175.3864335664336}, {11.2, 
    175.59503496503498}, {11.4, 175.81916083916082}, {11.6, 
    176.02797202797203}, {11.8, 176.2442657342657}, {12, 
    176.45391608391608}, {12.2, 176.6886013986014}, {12.4, 
    176.9281118881119}, {12.6, 177.19}, {12.8, 177.47}, {13, 
    177.7390909090909}, {13.2, 178.01503496503494}, {13.4, 
    178.2923076923077}, {13.6, 178.60461538461539}, {13.8, 
    178.92685314685315}, {14, 179.24713286713288}, {14.2, 
    179.5781818181818}, {14.4, 179.93076923076922}, {14.6, 
    180.32083916083917}, {14.8, 180.71741258741258}, {15, 
    181.124965034965}, {15.2, 181.55125874125875}, {15.4, 
    181.97825174825175}, {15.6, 182.41020979020982}, {15.8, 
    182.8441258741259}, {16, 183.3011188811189}, {16.2, 
    183.77636363636367}, {16.4, 184.26951048951048}, {16.6, 
    184.80447552447555}, {16.8, 185.37951048951047}, {17, 
    185.97846153846154}, {17.2, 186.58356643356643}, {17.4, 
    187.19545454545454}, {17.6, 187.81587412587407}, {17.8, 
    188.44538461538463}, {18, 189.08426573426573}, {18.2, 
    189.73111888111887}, {18.4, 190.38111888111888}, {18.6, 
    191.04258741258744}, {18.8, 191.7199300699301}, {19, 
    192.43076923076922}, {19.2, 193.16111888111888}, {19.4, 
    193.91048951048953}, {19.6, 194.68713286713282}, {19.8, 
    195.4913286713287}, {20, 196.32006993006993}, {20.2, 
    197.17510489510488}, {20.4, 198.05881118881118}, {20.6, 
    198.95755244755247}, {20.8, 199.8584615384615}, {21, 
    200.76384615384615}, {21.2, 201.68461538461537}, {21.4, 
    202.62685314685316}, {21.6, 203.66496503496504}, {21.8, 
    204.81300699300698}, {22, 205.96062937062936}, {22.2, 
    206.8897902097902}, {22.4, 207.50202797202797}, {22.6, 
    207.81699300699304}, {22.8, 207.95888111888112}, {23, 
    208.02839160839162}, {23.2, 208.14692307692306}, {23.4, 
    208.4265734265734}, {23.6, 208.94608391608392}, {23.8, 
    209.81937062937064}, {24, 211.1255244755245}, {24.2, 
    212.82013986013985}, {24.4, 214.7145454545455}, {24.6, 
    216.61958041958042}, {24.8, 218.50860139860137}, {25, 
    220.42069930069928}, {25.2, 222.4111888111888}, {25.4, 
    224.48314685314682}, {25.6, 226.616013986014}, {25.8, 
    228.8025874125874}, {26, 231.0102097902098}, {26.2, 
    233.26111888111888}, {26.4, 235.54636363636362}, {26.6, 
    237.8906293706294}, {26.8, 240.30881118881118}, {27, 
    242.80363636363634}, {27.2, 245.37720279720278}, {27.4, 
    248.0467132867133}, {27.6, 250.82118881118885}, {27.8, 
    253.69622377622377}, {28, 256.65937062937064}, {28.2, 
    259.7168531468531}, {28.4, 262.8809090909091}, {28.6, 
    266.136083916084}, {28.8, 269.48853146853145}, {29, 
    272.9494405594406}, {29.2, 276.5634265734266}, {29.4, 
    280.31496503496504}, {29.6, 284.1983916083916}, {29.8, 
    288.2063636363637}, {30, 292.3523076923077}, {30.2, 
    296.6392307692308}, {30.4, 301.0708391608391}, {30.6, 
    305.62391608391613}, {30.8, 310.3113286713287}, {31, 
    315.11034965034963}, {31.2, 320.04965034965034}, {31.4, 
    325.1569230769231}, {31.6, 330.4420979020979}, {31.8, 
    335.90902097902097}, {32, 341.55034965034963}, {32.2, 
    347.37482517482516}, {32.4, 353.38538461538457}, {32.6, 
    359.5694405594406}, {32.8, 365.93888111888117}, {33, 
    372.4761538461538}, {33.2, 379.2182517482518}, {33.4, 
    386.1609790209791}, {33.6, 393.32629370629365}, {33.8, 
    400.7041958041958}, {34, 408.26265734265735}, {34.2, 
    416.02657342657346}, {34.4, 423.96489510489516}, {34.6, 
    432.1181818181819}, {34.8, 440.4820979020979}, {35, 
    448.6806293706294}, {35.2, 456.86342657342664}, {35.4, 
    465.53755244755246}, {35.6, 475.66034965034964}, {35.8, 
    487.5865734265734}, {36, 501.1653146853147}, {36.2, 
    516.0813286713288}, {36.4, 531.9086013986014}, {36.6, 
    548.2587412587412}, {36.8, 564.6713986013987}, {37, 
    580.6118881118881}, {37.2, 595.7270629370629}, {37.4, 
    609.4006293706293}, {37.6, 622.2286013986014}, {37.8, 
    634.5355944055943}, {38, 647.2777622377623}, {38.2, 
    660.156153846154}, {38.4, 673.3221678321679}, {38.6, 
    686.4862237762237}, {38.8, 699.9664335664336}, {39, 
    713.5155244755244}, {39.2, 727.4389510489511}, {39.4, 
    741.0336363636363}, {39.6, 755.0702097902098}, {39.8, 
    769.5217482517482}, {40, 785.5246153846156}, {40.2, 
    802.3835664335664}, {40.4, 820.4558741258742}, {40.6, 
    838.8953146853147}, {40.8, 858.1897202797202}, {41, 
    877.5658741258741}, {41.2, 897.573986013986}, {41.4, 
    917.3868531468532}, {41.6, 937.4052447552448}, {41.8, 
    956.7482517482517}, {42, 976.6904895104893}, {42.2, 
    997.0346153846153}, {42.4, 1018.8477622377623}, {42.6, 
    1041.1142657342657}, {42.8, 1064.3213286713287}, {43, 
    1088.1560139860142}, {43.2, 1112.473986013986}, {43.4, 
    1137.4900699300697}, {43.6, 1164.0341958041959}, {43.8, 
    1192.6026573426573}, {44, 1223.4609090909091}, {44.2, 
    1255.9941258741258}, {44.4, 1290.8709790209791}, {44.6, 
    1327.0130769230768}, {44.8, 1364.6239860139858}, {45, 
    1402.7880419580417}, {45.2, 1442.381118881119}, {45.4, 
    1482.7290909090907}, {45.6, 1523.66013986014}, {45.8, 
    1565.570979020979}, {46, 1609.5718881118883}, {46.2, 
    1656.1732867132866}, {46.4, 1705.5791608391607}, {46.6, 
    1757.082797202797}, {46.8, 1811.405664335664}, {47, 
    1867.7601398601398}, {47.2, 1927.0214685314686}, {47.4, 
    1988.903566433566}, {47.6, 2053.9727272727273}, {47.8, 
    2121.3558741258735}, {48, 2191.253076923077}, {48.2, 
    2263.4567132867137}, {48.4, 2338.992097902097}, {48.6, 
    2417.6206293706296}, {48.8, 2499.507062937063}, {49, 
    2584.0679020979014}, {49.2, 2672.40048951049}, {49.4, 
    2764.2509090909093}, {49.6, 2860.08972027972}, {49.8, 
    2958.8880419580414}, {50, 3061.5296503496506}, {50.2, 
    3167.954475524476}, {50.4, 3279.3267132867136}, {50.6, 
    3394.996363636363}, {50.8, 3514.5386013986017}, {51, 
    3637.8941958041955}, {51.2, 3767.8172727272727}, {51.4, 
    3907.369160839161}, {51.6, 4057.940839160839}, {51.8, 
    4218.387692307691}, {52, 4387.486363636363}, {52.2, 
    4559.219090909091}, {52.4, 4737.994405594407}, {52.6, 
    4926.850629370629}, {52.8, 5133.069790209789}, {53, 
    5351.979300699301}, {53.2, 5580.233216783217}, {53.4, 
    5815.771258741259}, {53.6, 6059.474335664335}, {53.8, 
    6310.2300699300695}, {54, 6566.168951048951}, {54.2, 
    6824.079510489511}, {54.4, 7080.809090909091}, {54.6, 
    7333.146293706293}, {54.8, 7587.8459440559445}, {55, 
    7850.626853146852}, {55.2, 8125.57027972028}, {55.4, 
    8409.073496503495}, {55.6, 8698.83132867133}, {55.8, 
    8996.236433566435}, {56, 9300.716293706295}, {56.2, 
    9614.424195804197}, {56.4, 9936.465874125875}, {56.6, 
    10267.16895104895}, {56.8, 10604.112797202795}, {57, 
    10948.749580419582}, {57.2, 11300.41020979021}, {57.4, 
    11659.683006993006}, {57.6, 12023.626783216785}, {57.8, 
    12392.80202797203}, {58, 12766.768741258744}, {58.2, 
    13147.152517482516}, {58.4, 13533.405594405594}, {58.6, 
    13929.522447552448}, {58.8, 14331.496503496504}, {59, 
    14735.11027972028}, {59.2, 15134.907552447552}, {59.4, 
    15531.639090909091}, {59.6, 15926.898251748251}, {59.8, 
    16319.009370629366}, {60, 16708.945804195802}, {60.2, 
    17100.06636363636}, {60.4, 17496.746923076924}, {60.6, 
    17899.96601398601}, {60.8, 18310.962377622378}, {61, 
    18733.114335664337}, {61.2, 19158.742027972025}, {61.4, 
    19578.491538461538}, {61.6, 19983.563636363637}, {61.8, 
    20383.41286713287}, {62, 20771.78615384616}, {62.2, 
    21143.815874125874}, {62.4, 21493.19979020979}, {62.6, 
    21831.533146853144}, {62.8, 22165.208671328666}, {63, 
    22497.004265734264}, {63.2, 22829.18895104895}, {63.4, 
    23165.61839160839}, {63.6, 23505.106223776227}, {63.8, 
    23845.65895104895}, {64, 24185.918321678324}, {64.2, 
    24530.909580419582}, {64.4, 24870.472797202798}, {64.6, 
    25198.522797202797}, {64.8, 25507.47804195804}, {65, 
    25802.223846153847}, {65.2, 26082.483426573428}, {65.4, 
    26348.033426573424}, {65.6, 26600.166853146857}, {65.8, 
    26840.285384615385}, {66, 27072.183286713287}, {66.2, 
    27294.89937062937}, {66.4, 27510.708951048953}, {66.6, 
    27720.160139860138}, {66.8, 27922.566853146855}, {67, 
    28118.26083916084}, {67.2, 28307.706083916084}, {67.4, 
    28494.77258741259}, {67.6, 28679.58657342657}, {67.8, 
    28860.11972027972}, {68, 29039.42153846154}, {68.2, 
    29210.7306993007}, {68.4, 29366.41545454545}, {68.6, 
    29502.546223776226}, {68.8, 29629.67433566434}, {69, 
    29744.836363636365}, {69.2, 29836.08020979021}, {69.4, 
    29898.33790209791}, {69.6, 29933.56769230769}, {69.8, 
    29959.04762237762}, {70, 29975.020909090912}, {70.2, 
    29991.388531468532}, {70.4, 30006.784055944052}, {70.6, 
    30018.964685314684}, {70.8, 30026.687132867133}, {71, 
    30047.393426573428}, {71.2, 30084.82174825175}, {71.4, 
    30135.9965034965}, {71.6, 30182.328111888113}, {71.8, 
    30225.142167832168}, {72, 30268.663566433566}, {72.2, 
    30319.640629370628}, {72.4, 30372.744545454545}, {72.6, 
    30427.39160839161}, {72.8, 30477.89188811188}, {73, 
    30521.84727272727}, {73.2, 30553.777762237765}, {73.4, 
    30573.294825174824}, {73.6, 30571.749790209793}, {73.8, 
    30562.458741258743}, {74, 30552.884825174824}, {74.2, 
    30553.355174825174}, {74.4, 30564.295454545452}, {74.6, 
    30576.382587412594}, {74.8, 30594.90377622378}, {75, 
    30610.827692307692}, {75.2, 30633.06699300699}, {75.4, 
    30653.350000000002}, {75.6, 30666.33594405594}, {75.8, 
    30668.923426573427}, {76, 30668.75461538462}, {76.2, 
    30670.575314685306}, {76.4, 30670.93328671329}, {76.6, 
    30667.266083916085}, {76.8, 30663.819300699302}, {77, 
    30647.977062937065}, {77.2, 30618.72202797203}, {77.4, 
    30565.47013986014}, {77.6, 30508.620349650355}, {77.8, 
    30455.27230769231}, {78, 30410.724055944054}, {78.2, 
    30383.247272727276}, {78.4, 30363.072377622375}, {78.6, 
    30355.305034965033}, {78.8, 30342.20923076923}, {79, 
    30340.65146853147}, {79.2, 30337.188811188807}, {79.4, 
    30331.158181818184}, {79.6, 30315.162097902103}, {79.8, 
    30295.13181818182}, {80, 30271.48195804196}, {80.2, 
    30250.13118881119}, {80.4, 30224.207062937065}, {80.6, 
    30201.98300699301}, {80.8, 30170.62013986014}, {81, 
    30157.62923076923}, {81.2, 30143.96188811189}, {81.4, 
    30141.00909090909}, {81.6, 30117.328741258738}, {81.8, 
    30092.859790209794}, {82, 30056.212097902095}, {82.2, 
    30011.19230769231}, {82.4, 29951.637552447555}, {82.6, 
    29881.86965034965}, {82.8, 29809.408811188812}, {83, 
    29743.92013986014}, {83.2, 29687.225244755246}, {83.4, 
    29650.274545454547}, {83.6, 29609.51027972028}, {83.8, 
    29570.36111888112}, {84, 29528.284685314688}, {84.2, 
    29495.74104895105}, {84.4, 29464.83104895105}, {84.6, 
    29432.034545454546}, {84.8, 29397.90867132867}, {85, 
    29359.92979020979}, {85.2, 29328.5486013986}, {85.4, 
    29309.78937062937}, {85.6, 29295.625034965036}, {85.8, 
    29279.513916083917}, {86, 29255.218671328672}, {86.2, 
    29234.38566433567}, {86.4, 29227.73384615385}, {86.6, 
    29216.327202797198}, {86.8, 29201.22685314685}, {87, 
    29162.052937062937}, {87.2, 29113.863776223774}, {87.4, 
    29051.34391608391}, {87.6, 28988.94237762238}, {87.8, 
    28926.36160839161}, {88, 28856.33132867133}, {88.2, 
    28782.890699300704}, {88.4, 28712.760769230772}, {88.6, 
    28660.5920979021}, {88.8, 28620.868461538463}, {89, 
    28583.4386013986}, {89.2, 28546.60818181818}, {89.4, 
    28502.005384615386}, {89.6, 28462.87916083916}, {89.8, 
    28422.843076923076}, {90, 28389.142517482516}, {90.2, 
    28339.938461538462}, {90.4, 28275.94958041958}, {90.6, 
    28203.151538461538}, {90.8, 28132.62300699301}, {91, 
    28069.04839160839}, {91.2, 27992.026083916087}, {91.4, 
    27914.222797202798}, {91.6, 27834.239160839163}, {91.8, 
    27766.07118881119}, {92, 27716.52062937063}, {92.2, 
    27679.7613986014}, {92.4, 27652.8013986014}, {92.6, 
    27618.464055944052}, {92.8, 27588.78923076923}, {93, 
    27574.388531468536}, {93.2, 27566.27888111888}, {93.4, 
    27547.25811188811}, {93.6, 27502.117692307693}, {93.8, 
    27444.676573426572}};

ramp1FSmoothFunc[1] = Interpolation[ramp1FCelsiusXRFUSmooth[1]]


ClearAll[helixMidPoint, helixLineLength, helixLowPoint, \
helixLowPointRFU, helixHighPoint, helixHighPointRFU]
ClearAll[coilMidPoint, coilLineLength, coilLowPoint, coilLowPointRFU, \
coilHighPoint, coilHighPointRFU]
ramp1FCelsiusXRFUSmooth[1];
helixLowBarrier = 10;
helixHighBarrier = 40;
coilLowBarrier = 60;
coilHighBarrier = 90;

{Slider[Dynamic[helixMidPoint], {helixLowBarrier, helixHighBarrier}], 
 Dynamic[helixMidPoint], 
 Dynamic[helixMidPointRFU = ramp1FSmoothFunc[1][helixMidPoint]], 
 Slider[Dynamic[helixLineLength], {5, 25}], Dynamic[helixLineLength]}

{Slider[Dynamic[coilMidPoint], {coilLowBarrier, coilHighBarrier}], 
 Dynamic[coilMidPoint], 
 Dynamic[coilMidPointRFU = ramp1FSmoothFunc[1][coilMidPoint]], 
 Slider[Dynamic[coilLineLength], {5, 25}], Dynamic[coilLineLength]}

Dynamic[{ListPlot[{ramp1FCelsiusXRFUSmooth[
     1], {{helixLowPoint, helixLowPointRFU}}, {{helixHighPoint, 
      helixHighPointRFU}}, {{coilLowPoint, 
      coilLowPointRFU}}, {{coilHighPoint, coilHighPointRFU}}}, 
   ImageSize -> Medium, 
   PlotStyle -> {PointSize[Small], PointSize[Large], PointSize[Large],
      PointSize[Large], PointSize[Large]}],

  Grid[{{, "temperature (C)", "Interpolated RFU"}, {"helix low point",
      Dynamic[helixLowPoint = helixMidPoint - helixLineLength/2], 
     Dynamic[helixLowPointRFU = 
       ramp1FSmoothFunc[1][helixLowPoint]]}, {"helix high point", 
     Dynamic[helixHighPoint = helixMidPoint + helixLineLength/2], 
     Dynamic[helixHighPointRFU = 
       ramp1FSmoothFunc[1][
        helixHighPoint]]}, {, ,}, {"coil low point", 
     Dynamic[coilLowPoint = coilMidPoint - coilLineLength/2], 
     Dynamic[coilLowPointRFU = 
       ramp1FSmoothFunc[1][coilLowPoint]]}, {"coil high point", 
     Dynamic[coilHighPoint = coilMidPoint + coilLineLength/2], 
     Dynamic[coilHighPointRFU = ramp1FSmoothFunc[1][coilHighPoint]]}},
    Frame -> All]}]

Dynamic[ramp1FBaseLinesTEST = 
  Plot[{ramp1FHelixLinFitEqTEST[temp], 
    ramp1FCoilLinFitEqTEST[temp]}, {temp, 1, 100}]]




Dynamic[ramp1FHelixTEST = 
  Select[ramp1FCelsiusXRFUSmooth[1], 
   helixLowPoint <= #[[1]] <= helixHighPoint &]]

Dynamic[ramp1FHCoilTEST = 
  Select[ramp1FCelsiusXRFUSmooth[1], 
   coilLowPoint <= #[[1]] <= coilHighPoint &]]

Dynamic[ramp1FHelixLinFitTEST = 
  Fit[ramp1FHelixTEST, {1, temp}, temp]]
Dynamic[ramp1FHelixLinFitEqTEST[temp_] = ramp1FHelixLinFitTEST]
Dynamic[ramp1FCoilLinFitTEST = Fit[ramp1FHCoilTEST, {1, temp}, temp]]
Dynamic[ramp1FCoilLinFitEqTEST[temp_] = ramp1FCoilLinFitTEST]

1 个答案:

答案 0 :(得分:0)

看看Manipulate,它应该会自动化您尝试使用Dynamic做的事情。例如,Manipulate[Show[<plots>], {param, min, max}]应该有效。