0
$\begingroup$

If I have the following data:

data={{-0.00315, 0.126753}, {0.158, 0.34738}, {0.318, 0.610518}, {0.482, 
  0.708348}, {0.65, 0.6813}, {0.819, 0.562896}, {0.99, 
  0.41172}, {1.16, 0.275113}, {1.329, 0.16488}, {1.498, 
  0.0798336}, {1.666, 
  0.00903414}, {1.834, -0.0418784}, {2.002, -0.0870378}, {2.17, \
-0.125302}, {2.337, -0.158785}, {2.505, -0.181961}, {2.672, \
-0.200542}, {2.839, -0.216578}, {3.006, -0.231223}, {3.173, \
-0.239746}, {3.34, -0.247273}, {3.506, -0.253446}, {3.673, \
-0.258429}, {3.84, -0.262291}, {4.007, -0.265895}, {4.174, \
-0.268853}, {4.34, -0.27127}, {4.507, -0.27241}, {4.674, -0.274048}, \
{4.84, -0.275682}, {5.007, -0.277236}, {5.174, -0.278333}, {5.341, \
-0.279446}, {5.507, -0.280439}, {5.674, -0.281374}, {5.841, \
-0.28189}, {6.007, -0.282508}, {6.174, -0.283111}, {6.341, \
-0.283684}, {6.507, -0.284136}, {6.674, -0.284641}, {6.841, \
-0.285097}, {7.007, -0.285508}, {7.174, -0.285923}, {7.341, \
-0.286333}, {7.507, -0.286723}, {7.674, -0.287128}, {7.841, \
-0.28745}, {8.008, -0.287768}, {8.174, -0.288012}, {8.341, \
-0.288185}, {8.508, -0.288388}, {8.674, -0.288586}, {8.841, \
-0.288765}, {9.008, -0.288923}, {9.174, -0.289066}, {9.341, \
-0.289241}, {9.508, -0.289455}, {9.674, -0.289681}, {9.841, \
-0.289853}, {10.008, -0.289974}, {10.174, -0.290014}, {10.341, \
-0.289988}, {10.508, -0.289898}, {10.674, -0.289901}, {10.841, \
-0.289859}, {11.008, -0.289781}, {11.174, -0.289699}, {11.341, \
-0.289642}, {11.508, -0.289568}, {11.674, -0.289438}, {11.841, \
-0.289345}, {12.008, -0.289218}, {12.174, -0.289121}, {12.341, \
-0.289008}, {12.508, -0.288971}, {12.674, -0.288876}, {12.841, \
-0.288826}, {13.008, -0.288822}, {13.174, -0.288812}, {13.341, \
-0.288805}, {13.508, -0.288748}, {13.674, -0.288629}, {13.841, \
-0.288436}, {14.008, -0.288274}, {14.174, -0.288134}, {14.341, \
-0.28802}, {14.508, -0.287779}, {14.674, -0.287551}, {14.841, \
-0.28736}, {15.008, -0.287181}, {15.175, -0.286937}, {15.341, \
-0.286592}, {15.508, -0.286185}, {15.674, -0.285752}, {15.841, \
-0.285263}, {16.008, -0.284903}, {16.174, -0.284575}, {16.341, \
-0.28426}, {16.508, -0.284071}, {16.674, -0.283819}, {16.841, \
-0.283513}, {17.008, -0.283166}, {17.174, -0.282799}, {17.341, \
-0.282432}, {17.508, -0.282055}, {17.674, -0.281696}, {17.841, \
-0.281354}, {18.008, -0.281035}, {18.174, -0.280757}, {18.341, \
-0.280478}, {18.508, -0.280334}, {18.674, -0.280169}, {18.841, \
-0.280018}, {19.008, -0.279858}, {19.174, -0.279541}, {19.341, \
-0.279208}, {19.508, -0.278857}, {19.674, -0.278511}, {19.841, \
-0.277801}, {20.008, -0.277262}, {20.174, -0.276875}, {20.341, \
-0.276549}, {20.508, -0.276254}, {20.674, -0.275957}, {20.841, \
-0.275636}, {21.008, -0.275297}, {21.174, -0.275031}, {21.341, \
-0.274609}, {21.508, -0.27409}, {21.674, -0.273611}, {21.841, \
-0.273017}, {22.008, -0.272631}, {22.174, -0.272325}, {22.341, \
-0.272017}, {22.508, -0.271829}, {22.674, -0.271543}, {22.841, \
-0.271195}, {23.008, -0.270794}, {23.174, -0.270298}, {23.341, \
-0.269889}, {23.508, -0.269427}, {23.674, -0.268928}, {23.841, \
-0.268469}, {24.008, -0.267981}, {24.174, -0.267485}, {24.341, \
-0.267031}, {24.508, -0.266577}, {24.674, -0.266117}, {24.841, \
-0.265664}, {25.008, -0.265204}, {25.174, -0.264693}, {25.341, \
-0.264208}, {25.508, -0.263781}, {25.674, -0.263336}, {25.841, \
-0.262832}, {26.008, -0.262378}, {26.174, -0.261943}, {26.341, \
-0.261538}, {26.508, -0.261139}, {26.674, -0.260697}, {26.841, \
-0.260294}, {27.008, -0.259955}, {27.174, -0.259616}, {27.341, \
-0.259274}, {27.508, -0.258875}, {27.674, -0.258428}, {27.841, \
-0.258035}, {28.008, -0.257551}, {28.174, -0.256993}, {28.341, \
-0.256446}, {28.508, -0.255803}, {28.674, -0.255216}, {28.841, \
-0.254585}, {29.008, -0.253943}, {29.174, -0.253247}, {29.341, \
-0.252542}, {29.507, -0.251793}, {29.674, -0.251058}, {29.841, \
-0.250282}, {30.007, -0.24952}, {30.174, -0.24874}, {30.341, \
-0.247909}, {30.507, -0.247148}, {30.674, -0.246381}, {30.841, \
-0.245575}, {31.007, -0.244719}, {31.174, -0.24374}, {31.341, \
-0.242809}, {31.507, -0.241985}, {31.674, -0.241181}, {31.841, \
-0.240141}, {32.007, -0.239135}, {32.174, -0.238192}, {32.34, \
-0.237251}, {32.507, -0.236159}, {32.674, -0.235149}, {32.84, \
-0.234189}, {33.007, -0.233218}, {33.174, -0.232171}, {33.34, \
-0.231172}, {33.507, -0.230185}, {33.674, -0.22918}, {33.84, \
-0.228132}, {34.007, -0.227082}, {34.174, -0.226049}, {34.34, \
-0.225023}, {34.507, -0.223832}, {34.673, -0.222559}, {34.84, \
-0.221244}, {35.007, -0.219934}, {35.173, -0.218317}, {35.34, \
-0.216785}, {35.507, -0.215324}, {35.673, -0.213929}, {35.84, \
-0.212302}, {36.006, -0.210644}, {36.173, -0.208982}, {36.34, \
-0.207308}, {36.506, -0.205411}, {36.673, -0.203602}, {36.84, \
-0.201773}, {37.006, -0.199953}, {37.173, -0.198106}, {37.339, \
-0.196219}, {37.506, -0.194192}, {37.673, -0.192115}, {37.839, \
-0.189914}, {38.006, -0.18776}, {38.172, -0.185668}, {38.339, \
-0.183607}, {38.506, -0.181263}, {38.672, -0.17896}, {38.839, \
-0.176679}, {39.005, -0.174385}, {39.172, -0.171894}, {39.339, \
-0.169328}, {39.505, -0.166651}, {39.672, -0.163939}, {39.838, \
-0.161041}, {40.005, -0.158169}, {40.172, -0.155214}, {40.338, \
-0.152182}, {40.505, -0.148979}, {40.671, -0.145736}, {40.838, \
-0.142339}, {41.004, -0.138837}, {41.171, -0.134978}, {41.337, \
-0.131147}, {41.504, -0.12719}, {41.671, -0.123083}, {41.837, \
-0.118575}, {42.004, -0.114119}, {42.17, -0.109542}, {42.337, \
-0.104877}, {42.503, -0.0996522}, {42.67, -0.0945852}, {42.836, \
-0.0891624}, {43.003, -0.083505}, {43.169, -0.076785}, {43.336, \
-0.0704892}, {43.502, -0.0641094}, {43.669, -0.0575858}, {43.835, \
-0.0505137}, {44.001, -0.0435692}, {44.168, -0.0365599}, {44.334, \
-0.0292208}, {44.501, -0.021045}, {44.667, -0.0131527}, {44.833, \
-0.00518114}, {45., 0.00288158}, {45.166, 0.011333}, {45.333, 
  0.0197519}, {45.499, 0.0282636}, {45.665, 0.0368329}, {45.832, 
  0.0457119}, {45.998, 0.0545137}, {46.165, 0.0633846}, {46.331, 
  0.0722946}, {46.497, 0.0813336}, {46.664, 0.090318}, {46.83, 
  0.0992748}, {46.996, 0.108215}, {47.163, 0.117015}, {47.329, 
  0.125778}, {47.496, 0.134474}, {47.662, 0.143154}, {47.828, 
  0.151453}, {47.995, 0.159776}, {48.161, 0.168047}, {48.328, 
  0.176035}, {48.494, 0.183261}, {48.66, 0.190688}, {48.827, 
  0.197972}, {48.993, 0.205079}, {49.16, 0.211915}, {49.326, 
  0.218641}, {49.493, 0.224641}, {49.659, 0.230096}, {49.826, 
  0.234929}, {49.992, 0.239776}, {50.159, 0.244378}, {50.325, 
  0.248743}, {50.492, 0.252269}, {50.658, 0.255722}, {50.825, 
  0.258829}, {50.991, 0.261665}, {51.158, 0.263764}, {51.325, 
  0.26555}, {51.491, 0.26677}, {51.658, 0.267373}, {51.824, 
  0.267384}, {51.991, 0.267375}, {52.158, 0.267326}, {52.324, 
  0.266765}, {52.491, 0.265855}, {52.658, 0.265103}, {52.825, 
  0.26389}, {52.991, 0.262271}, {53.158, 0.260472}, {53.325, 
  0.25842}, {53.491, 0.256185}, {53.658, 0.253946}, {53.825, 
  0.251351}, {53.992, 0.248946}, {54.158, 0.246508}, {54.325, 
  0.244065}, {54.492, 0.241578}, {54.659, 0.239058}, {54.825, 
  0.23647}, {54.992, 0.233869}, {55.159, 0.231235}, {55.326, 
  0.228711}, {55.492, 0.226229}, {55.659, 0.22376}, {55.826, 
  0.221422}, {55.993, 0.219029}, {56.159, 0.216697}, {56.326, 
  0.214469}, {56.493, 0.212241}, {56.66, 0.209987}, {56.826, 
  0.207697}, {56.993, 0.205387}, {57.16, 0.203096}, {57.326, 
  0.200839}, {57.493, 0.198632}, {57.66, 0.196401}, {57.827, 
  0.194282}, {57.993, 0.19223}, {58.16, 0.19021}, {58.327, 
  0.188157}, {58.494, 0.186269}, {58.66, 0.184274}, {58.827, 
  0.182289}, {58.994, 0.180325}, {59.161, 0.178318}, {59.327, 
  0.176348}, {59.494, 0.174424}, {59.661, 0.172544}, {59.827, 
  0.170756}, {59.994, 0.168949}, {60.161, 0.167176}, {60.328, 
  0.165421}, {60.494, 0.163828}, {60.661, 0.162229}, {60.828, 
  0.160689}, {60.994, 0.1592}, {61.161, 0.158029}, {61.328, 
  0.156791}, {61.495, 0.155587}, {61.661, 0.154434}, {61.828, 
  0.153685}, {61.995, 0.152843}, {62.161, 0.151995}, {62.328, 
  0.151172}, {62.495, 0.150676}, {62.661, 0.150183}, {62.828, 
  0.149729}, {62.995, 0.149264}, {63.161, 0.149044}, {63.328, 
  0.148768}, {63.495, 0.14846}, {63.661, 0.148177}, {63.828, 
  0.147968}, {63.995, 0.147832}, {64.161, 0.147751}, {64.328, 
  0.147681}, {64.495, 0.147871}, {64.661, 0.14798}, {64.828, 
  0.148045}, {64.995, 0.148127}, {65.161, 0.148333}, {65.328, 
  0.148519}, {65.495, 0.148746}, {65.661, 0.148993}, {65.828, 
  0.149293}, {65.995, 0.149581}, {66.161, 0.14984}, {66.328, 
  0.150074}, {66.495, 0.150317}, {66.661, 0.150594}, {66.828, 
  0.150893}, {66.995, 0.151145}, {67.161, 0.151349}, {67.328, 
  0.151596}, {67.495, 0.151879}, {67.661, 0.152171}, {67.828, 
  0.152417}, {67.995, 0.152683}, {68.161, 0.15298}, {68.328, 
  0.153264}, {68.494, 0.153519}, {68.661, 0.15379}, {68.828, 
  0.154074}, {68.994, 0.154343}, {69.161, 0.154639}, {69.328, 
  0.154867}, {69.494, 0.155066}, {69.661, 0.155256}, {69.828, 
  0.155428}, {69.994, 0.155633}, {70.161, 0.155835}, {70.328, 
  0.156048}, {70.494, 0.156208}, {70.661, 0.156371}, {70.828, 
  0.156583}, {70.994, 0.156855}, {71.161, 0.157074}, {71.328, 
  0.157241}, {71.494, 0.157373}, {71.661, 0.157471}, {71.828, 
  0.1576}, {71.994, 0.157742}, {72.161, 0.157854}, {72.328, 
  0.157965}, {72.494, 0.157954}, {72.661, 0.157978}, {72.828, 
  0.158011}, {72.994, 0.158083}, {73.161, 0.158084}, {73.328, 
  0.15812}, {73.494, 0.158182}, {73.661, 0.158249}, {73.827, 
  0.158411}, {73.994, 0.158559}, {74.161, 0.158732}, {74.327, 
  0.158946}, {74.494, 0.159179}, {74.661, 0.159352}, {74.827, 
  0.159518}, {74.994, 0.15972}, {75.161, 0.159878}, {75.327, 
  0.16}, {75.494, 0.16012}, {75.661, 0.160271}, {75.827, 
  0.160365}, {75.994, 0.160493}, {76.161, 0.160636}, {76.327, 
  0.160767}, {76.494, 0.161044}, {76.661, 0.161255}, {76.827, 
  0.161402}, {76.994, 0.161526}, {77.161, 0.161749}, {77.327, 
  0.161882}, {77.494, 0.161957}, {77.661, 0.162052}, {77.827, 
  0.162061}, {77.994, 0.162069}, {78.161, 0.162112}, {78.327, 
  0.162212}, {78.494, 0.162309}, {78.661, 0.162411}, {78.827, 
  0.162493}, {78.994, 0.162625}, {79.161, 0.16282}, {79.327, 
  0.163015}, {79.494, 0.163262}, {79.66, 0.163579}, {79.827, 
  0.163916}, {79.994, 0.164259}, {80.16, 0.164585}, {80.327, 
  0.164895}, {80.494, 0.165142}, {80.66, 0.165362}, {80.827, 
  0.165622}, {80.994, 0.165866}, {81.16, 0.16601}, {81.327, 
  0.166204}, {81.494, 0.166403}, {81.66, 0.166623}, {81.827, 
  0.166899}, {81.994, 0.167171}, {82.16, 0.167443}, {82.327, 
  0.16771}, {82.494, 0.167924}, {82.66, 0.16811}, {82.827, 
  0.168226}, {82.994, 0.168308}, {83.16, 0.168347}, {83.327, 
  0.168486}, {83.494, 0.168626}, {83.66, 0.168751}, {83.827, 
  0.169016}, {83.993, 0.169215}, {84.16, 0.16939}, {84.327, 
  0.16958}, {84.493, 0.169761}, {84.66, 0.169925}, {84.827, 
  0.170097}, {84.993, 0.17027}, {85.16, 0.170453}, {85.327, 
  0.170647}, {85.493, 0.170833}, {85.66, 0.171079}, {85.827, 
  0.171308}, {85.993, 0.171482}, {86.16, 0.171641}, {86.327, 
  0.171863}, {86.493, 0.171949}, {86.66, 0.172118}, {86.827, 
  0.172321}, {86.993, 0.172513}, {87.16, 0.172724}, {87.327, 
  0.172895}, {87.493, 0.17308}, {87.66, 0.173278}, {87.827, 
  0.173467}, {87.993, 0.173731}, {88.16, 0.174029}, {88.326, 
  0.174274}, {88.493, 0.174671}, {88.66, 0.175004}, {88.826, 
  0.175321}, {88.993, 0.175669}, {89.16, 0.175955}, {89.326, 
  0.176202}, {89.493, 0.176432}, {89.66, 0.176686}, {89.826, 
  0.176854}, {89.993, 0.177096}, {90.16, 0.177341}, {90.326, 
  0.177566}, {90.493, 0.177875}, {90.66, 0.178146}, {90.826, 
  0.178371}, {90.993, 0.178553}, {91.16, 0.178652}, {91.326, 
  0.178772}, {91.493, 0.178895}, {91.66, 0.179004}, {91.826, 
  0.179097}, {91.993, 0.179259}, {92.16, 0.179472}, {92.326, 
  0.179722}, {92.493, 0.180107}, {92.659, 0.180471}, {92.826, 
  0.180821}, {92.993, 0.18114}, {93.159, 0.181528}, {93.326, 
  0.181818}, {93.493, 0.182092}, {93.659, 0.182398}, {93.826, 
  0.182523}, {93.993, 0.182656}, {94.159, 0.182842}, {94.326, 
  0.183071}, {94.493, 0.183302}, {94.659, 0.183563}, {94.826, 
  0.183825}, {94.993, 0.184069}, {95.159, 0.184417}, {95.326, 
  0.184631}, {95.493, 0.184816}, {95.659, 0.185008}, {95.826, 
  0.185064}, {95.993, 0.185173}, {96.159, 0.185291}, {96.326, 
  0.185458}, {96.492, 0.18562}, {96.659, 0.185752}, {96.826, 
  0.185963}, {96.992, 0.186226}, {97.159, 0.186486}, {97.326, 
  0.186771}, {97.492, 0.187079}, {97.659, 0.187382}, {97.826, 
  0.187623}, {97.992, 0.187864}, {98.159, 0.188131}, {98.326, 
  0.188344}, {98.492, 0.188504}, {98.659, 0.188669}, {98.826, 
  0.188812}, {98.992, 0.188936}, {99.159, 0.18909}, {99.326, 
  0.18928}, {99.492, 0.189456}, {99.659, 0.189623}, {99.826, 
  0.189791}}

which plotted like ListPlot[data, PlotRange -> {{20, 80}, All}] gives:

enter image description here

Question:

How can I calculate DT like in this Figure?:

enter image description here

Steps to calculate DT:

  1. Get the extrapolated lines of the two base lines like this:

    `datglass = Select[data, 20 <= #[1] <= 33 &]; datliq = Select[datTCpc, 65 <= #[1] <= 80 &]; mod1 = LinearModelFit[datglass2, x, x]; mod2 = LinearModelFit[datliq2, x, x];

    Show[

    ListPlot[data, PlotRange -> {{20, 80}, All}],

    Plot[mod1[x], {x, 20, 100}, PlotStyle -> {Green, Dashed}],

    Plot[mod2[x], {x, 20, 100}, PlotStyle -> {Green, Dashed}]

    ]`

which gives:

enter image description here

  1. Get the change of the extrapolated lines at one temperature (for example 45) like this:

mod2[45] - mod1[45] (*0.340854*)

Please notice that this change is performed at a single x-value. Depending on the x-value choosen (here 45) the 16% change or 84% can be different. If I choose this to be x=30, then the total change would be slightly smaller and therefor 16% and 84% will be reach at different points than at x=45 as an example

  1. Get the value where the change calculated in step 2 is approximately 16% (starting from down to up) and also where it is 84% and get the x-value of the curve at those points. Lets call the point at 16% x1 and the one at 84% x2. This step I dont know how to do it

  2. Calculate DT by simply subtracting the x values at 84% and 16% simply by x2-x1. In the reference figure DTis 5 as x1 was 40 and x2 was 45.

PLEASE NOTICE THAT I AM NOT ASKING FOR HOW TO DRAW THE PLOT BUT TO GET THE DT VALUE. IT WOULD BE A PLUS THE PLOT AND THE VALUE. IN THIS CASE DT IS NOT NECCESARY 5 AS THIS IS ANOTHER TYPE OF DATA

UPDATA WITH ANOTHER DATA

I am trying to use the same code developed by @Daniel Huber with this data:

data1={{-0.001538, 2.26641}, {0.163, 2.70654}, {0.328, 2.97845}, {0.495, 
  2.80285}, {0.665, 2.29012}, {0.837, 1.35502}, {1.009, 
  0.477173}, {1.18, -0.256822}, {1.35, -0.878713}, {1.519, -1.27913}, \
{1.688, -1.60982}, {1.856, -1.8833}, {2.024, -2.12398}, {2.192, \
-2.29115}, {2.359, -2.4347}, {2.527, -2.54921}, {2.694, -2.64513}, \
{2.861, -2.70857}, {3.028, -2.76646}, {3.195, -2.81171}, {3.362, \
-2.85255}, {3.529, -2.8834}, {3.696, -2.90407}, {3.862, -2.92046}, \
{4.029, -2.93558}, {4.196, -2.94825}, {4.363, -2.96032}, {4.53, \
-2.97217}, {4.696, -2.9837}, {4.863, -2.99274}, {5.03, -3.00218}, \
{5.197, -3.0115}, {5.363, -3.02062}, {5.53, -3.02815}, {5.697, \
-3.03603}, {5.864, -3.04375}, {6.03, -3.0516}, {6.197, -3.05826}, \
{6.364, -3.06483}, {6.531, -3.07113}, {6.697, -3.07755}, {6.864, \
-3.08303}, {7.031, -3.08886}, {7.197, -3.09423}, {7.364, -3.09916}, \
{7.531, -3.1043}, {7.698, -3.1094}, {7.864, -3.11439}, {8.031, \
-3.11904}, {8.198, -3.1233}, {8.365, -3.12774}, {8.531, -3.13246}, \
{8.698, -3.13688}, {8.865, -3.14108}, {9.031, -3.14528}, {9.198, \
-3.14939}, {9.365, -3.1533}, {9.532, -3.15764}, {9.698, -3.16169}, \
{9.865, -3.16552}, {10.032, -3.16904}, {10.199, -3.17313}, {10.365, \
-3.17728}, {10.532, -3.18108}, {10.699, -3.18471}, {10.865, \
-3.18847}, {11.032, -3.19205}, {11.199, -3.19563}, {11.366, \
-3.19922}, {11.532, -3.20244}, {11.699, -3.20571}, {11.866, \
-3.20887}, {12.032, -3.21203}, {12.199, -3.21519}, {12.366, \
-3.21798}, {12.533, -3.22049}, {12.699, -3.22305}, {12.866, \
-3.22566}, {13.033, -3.22817}, {13.199, -3.23038}, {13.366, \
-3.23265}, {13.533, -3.23521}, {13.7, -3.23757}, {13.866, -3.23994}, \
{14.033, -3.24213}, {14.2, -3.24431}, {14.366, -3.24665}, {14.533, \
-3.249}, {14.7, -3.25138}, {14.867, -3.2536}, {15.033, -3.25595}, \
{15.2, -3.25822}, {15.367, -3.26053}, {15.533, -3.26267}, {15.7, \
-3.26504}, {15.867, -3.26735}, {16.034, -3.26972}, {16.2, -3.27189}, \
{16.367, -3.2743}, {16.534, -3.27689}, {16.7, -3.27947}, {16.867, \
-3.28199}, {17.034, -3.28426}, {17.201, -3.28623}, {17.367, \
-3.28811}, {17.534, -3.28959}, {17.701, -3.29127}, {17.867, \
-3.29278}, {18.034, -3.2943}, {18.201, -3.29545}, {18.368, -3.2967}, \
{18.534, -3.29812}, {18.701, -3.2995}, {18.868, -3.3007}, {19.034, \
-3.30211}, {19.201, -3.30348}, {19.368, -3.30471}, {19.535, \
-3.30603}, {19.701, -3.30718}, {19.868, -3.30833}, {20.035, \
-3.30956}, {20.201, -3.31049}, {20.368, -3.31168}, {20.535, \
-3.31328}, {20.701, -3.31484}, {20.868, -3.31616}, {21.035, \
-3.31781}, {21.202, -3.31942}, {21.368, -3.32071}, {21.535, \
-3.32215}, {21.702, -3.32349}, {21.868, -3.32466}, {22.035, \
-3.32584}, {22.202, -3.32742}, {22.369, -3.3288}, {22.535, -3.33023}, \
{22.702, -3.33186}, {22.869, -3.33367}, {23.035, -3.33526}, {23.202, \
-3.33679}, {23.369, -3.33836}, {23.536, -3.339}, {23.702, -3.33991}, \
{23.869, -3.34088}, {24.036, -3.34209}, {24.202, -3.34272}, {24.369, \
-3.34368}, {24.536, -3.34489}, {24.703, -3.34625}, {24.869, \
-3.34804}, {25.036, -3.3494}, {25.203, -3.35063}, {25.369, -3.35232}, \
{25.536, -3.35339}, {25.703, -3.35458}, {25.869, -3.35593}, {26.036, \
-3.35718}, {26.203, -3.35729}, {26.37, -3.35783}, {26.536, -3.3587}, \
{26.703, -3.35954}, {26.87, -3.35995}, {27.036, -3.36046}, {27.203, \
-3.3609}, {27.37, -3.36126}, {27.537, -3.36167}, {27.703, -3.36184}, \
{27.87, -3.3621}, {28.037, -3.36258}, {28.203, -3.36325}, {28.37, \
-3.36399}, {28.537, -3.36457}, {28.703, -3.36515}, {28.87, -3.36614}, \
{29.037, -3.36694}, {29.204, -3.36787}, {29.37, -3.36887}, {29.537, \
-3.36937}, {29.704, -3.37021}, {29.87, -3.3711}, {30.037, -3.37182}, \
{30.204, -3.37223}, {30.37, -3.37274}, {30.537, -3.37345}, {30.704, \
-3.3742}, {30.871, -3.37456}, {31.037, -3.37516}, {31.204, -3.37571}, \
{31.371, -3.37625}, {31.537, -3.37699}, {31.704, -3.37766}, {31.871, \
-3.37825}, {32.038, -3.37866}, {32.204, -3.37932}, {32.371, \
-3.37987}, {32.538, -3.38029}, {32.704, -3.38055}, {32.871, \
-3.38092}, {33.038, -3.38099}, {33.204, -3.38103}, {33.371, -3.3811}, \
{33.538, -3.38113}, {33.705, -3.38101}, {33.871, -3.38074}, {34.038, \
-3.38059}, {34.205, -3.38085}, {34.371, -3.38078}, {34.538, \
-3.38033}, {34.705, -3.37953}, {34.871, -3.37892}, {35.038, \
-3.37818}, {35.205, -3.37749}, {35.372, -3.37687}, {35.538, \
-3.37601}, {35.705, -3.37528}, {35.872, -3.37484}, {36.038, \
-3.37447}, {36.205, -3.37399}, {36.372, -3.37346}, {36.538, \
-3.37283}, {36.705, -3.37201}, {36.872, -3.37123}, {37.038, \
-3.37041}, {37.205, -3.36921}, {37.372, -3.3677}, {37.539, -3.36629}, \
{37.705, -3.3648}, {37.872, -3.36307}, {38.039, -3.3611}, {38.205, \
-3.35875}, {38.372, -3.35683}, {38.539, -3.35479}, {38.705, \
-3.35248}, {38.872, -3.3493}, {39.039, -3.3461}, {39.205, -3.34291}, \
{39.372, -3.3396}, {39.539, -3.33475}, {39.705, -3.33046}, {39.872, \
-3.32603}, {40.039, -3.32139}, {40.205, -3.31585}, {40.372, \
-3.31055}, {40.539, -3.30487}, {40.705, -3.2992}, {40.872, -3.29307}, \
{41.039, -3.28689}, {41.205, -3.28041}, {41.372, -3.27368}, {41.539, \
-3.26604}, {41.705, -3.25817}, {41.872, -3.2497}, {42.039, -3.23927}, \
{42.205, -3.2273}, {42.372, -3.2156}, {42.538, -3.20316}, {42.705, \
-3.19005}, {42.872, -3.17445}, {43.038, -3.15944}, {43.205, \
-3.14379}, {43.371, -3.12596}, {43.538, -3.10652}, {43.704, \
-3.08829}, {43.871, -3.06856}, {44.038, -3.04632}, {44.204, \
-3.01981}, {44.37, -2.99224}, {44.537, -2.96199}, {44.703, -2.92876}, \
{44.87, -2.89357}, {45.036, -2.85849}, {45.203, -2.82048}, {45.369, \
-2.78032}, {45.535, -2.73557}, {45.702, -2.69131}, {45.868, \
-2.64817}, {46.035, -2.60535}, {46.201, -2.56072}, {46.367, \
-2.51781}, {46.534, -2.4778}, {46.7, -2.43909}, {46.867, -2.41276}, \
{47.033, -2.39244}, {47.2, -2.38113}, {47.366, -2.37666}, {47.533, \
-2.39127}, {47.7, -2.41467}, {47.867, -2.44979}, {48.034, -2.49259}, \
{48.201, -2.55015}, {48.368, -2.61479}, {48.536, -2.67798}, {48.703, \
-2.74132}, {48.87, -2.80162}, {49.037, -2.85702}, {49.204, -2.90587}, \
{49.371, -2.94993}, {49.538, -2.9812}, {49.705, -3.00676}, {49.872, \
-3.02562}, {50.039, -3.04274}, {50.205, -3.05399}, {50.372, \
-3.06421}, {50.539, -3.07176}, {50.706, -3.07712}, {50.872, \
-3.08042}, {51.039, -3.08486}, {51.206, -3.08872}, {51.373, \
-3.09215}, {51.539, -3.0944}, {51.706, -3.09713}, {51.873, -3.09956}, \
{52.039, -3.1018}, {52.206, -3.10331}, {52.373, -3.10512}, {52.54, \
-3.10694}, {52.706, -3.10889}, {52.873, -3.11015}, {53.04, -3.11155}, \
{53.206, -3.11276}, {53.373, -3.11392}, {53.54, -3.11483}, {53.707, \
-3.11594}, {53.873, -3.11723}, {54.04, -3.1187}, {54.207, -3.11987}, \
{54.373, -3.1208}, {54.54, -3.12182}, {54.707, -3.12322}, {54.874, \
-3.12389}, {55.04, -3.1249}, {55.207, -3.12583}, {55.374, -3.12675}, \
{55.54, -3.12768}, {55.707, -3.12841}, {55.874, -3.12894}, {56.04, \
-3.12974}, {56.207, -3.13029}, {56.374, -3.13117}, {56.541, \
-3.13199}, {56.707, -3.13253}, {56.874, -3.13346}, {57.041, \
-3.13419}, {57.207, -3.1349}, {57.374, -3.13577}, {57.541, -3.13673}, \
{57.707, -3.13775}, {57.874, -3.13874}, {58.041, -3.13986}, {58.208, \
-3.14108}, {58.374, -3.14227}, {58.541, -3.14371}, {58.708, \
-3.14541}, {58.874, -3.14667}, {59.041, -3.14806}, {59.208, \
-3.14936}, {59.375, -3.15035}, {59.541, -3.15093}, {59.708, \
-3.15153}, {59.875, -3.15204}, {60.041, -3.15259}, {60.208, \
-3.15286}, {60.375, -3.15331}, {60.542, -3.15382}, {60.708, \
-3.15441}, {60.875, -3.15526}, {61.042, -3.15584}, {61.208, \
-3.15649}, {61.375, -3.15735}, {61.542, -3.15794}, {61.708, \
-3.15853}, {61.875, -3.15903}, {62.042, -3.15954}, {62.209, \
-3.16029}, {62.375, -3.16111}, {62.542, -3.16198}, {62.709, \
-3.16293}, {62.875, -3.16414}, {63.042, -3.16488}, {63.209, \
-3.16523}, {63.376, -3.16544}, {63.542, -3.16512}, {63.709, \
-3.16478}, {63.876, -3.16447}, {64.042, -3.1643}, {64.209, -3.16428}, \
{64.376, -3.16453}, {64.542, -3.16472}, {64.709, -3.16491}, {64.876, \
-3.16592}, {65.043, -3.16649}, {65.209, -3.1669}, {65.376, -3.16724}, \
{65.543, -3.16794}, {65.709, -3.16872}, {65.876, -3.16947}, {66.043, \
-3.17045}, {66.209, -3.17175}, {66.376, -3.17286}, {66.543, \
-3.17388}, {66.71, -3.17486}, {66.876, -3.1752}, {67.043, -3.17552}, \
{67.21, -3.17595}, {67.376, -3.17627}, {67.543, -3.17659}, {67.71, \
-3.17722}, {67.877, -3.17765}, {68.043, -3.17803}, {68.21, -3.1792}, \
{68.377, -3.17991}, {68.543, -3.18039}, {68.71, -3.18084}, {68.877, \
-3.18093}, {69.043, -3.18112}, {69.21, -3.18162}, {69.377, -3.18217}, \
{69.544, -3.18261}, {69.71, -3.18302}, {69.877, -3.18345}, {70.044, \
-3.18395}, {70.21, -3.18487}, {70.377, -3.18543}, {70.544, -3.186}, \
{70.711, -3.18667}, {70.877, -3.18754}, {71.044, -3.18849}, {71.211, \
-3.18952}, {71.377, -3.19067}, {71.544, -3.19142}, {71.711, \
-3.19204}, {71.877, -3.19248}, {72.044, -3.19301}, {72.211, \
-3.19295}, {72.378, -3.19334}, {72.544, -3.19394}, {72.711, \
-3.19464}, {72.878, -3.19587}, {73.044, -3.19667}, {73.211, \
-3.19722}, {73.378, -3.19759}, {73.545, -3.198}, {73.711, -3.19873}, \
{73.878, -3.1996}, {74.045, -3.20035}, {74.211, -3.20105}, {74.378, \
-3.2019}, {74.545, -3.20264}, {74.711, -3.20322}, {74.878, -3.20365}, \
{75.045, -3.20413}, {75.212, -3.20473}, {75.378, -3.20529}, {75.545, \
-3.20568}, {75.712, -3.20605}, {75.878, -3.20645}, {76.045, \
-3.20676}, {76.212, -3.20722}, {76.378, -3.20783}, {76.545, \
-3.20856}, {76.712, -3.20912}, {76.879, -3.20979}, {77.045, \
-3.21056}, {77.212, -3.21135}, {77.379, -3.21183}, {77.545, \
-3.21243}, {77.712, -3.21325}, {77.879, -3.21396}, {78.046, \
-3.21456}, {78.212, -3.21531}, {78.379, -3.216}, {78.546, -3.21655}, \
{78.712, -3.21719}, {78.879, -3.21792}, {79.046, -3.21871}, {79.212, \
-3.21949}, {79.379, -3.22028}, {79.546, -3.22158}, {79.713, \
-3.22287}, {79.879, -3.2241}, {80.046, -3.22514}, {80.213, -3.22613}, \
{80.379, -3.22681}, {80.546, -3.22724}, {80.713, -3.22747}, {80.88, \
-3.22699}, {81.046, -3.22707}, {81.213, -3.22742}, {81.38, -3.2278}, \
{81.546, -3.22833}, {81.713, -3.22886}, {81.88, -3.22959}, {82.046, \
-3.23035}, {82.213, -3.231}, {82.38, -3.23159}, {82.547, -3.23249}, \
{82.713, -3.23358}, {82.88, -3.23417}, {83.047, -3.23486}, {83.213, \
-3.23547}, {83.38, -3.23607}, {83.547, -3.23639}, {83.714, -3.23688}, \
{83.88, -3.23748}, {84.047, -3.23806}, {84.214, -3.23832}, {84.38, \
-3.23879}, {84.547, -3.23916}, {84.714, -3.23936}, {84.88, -3.23948}, \
{85.047, -3.23981}, {85.214, -3.24034}, {85.381, -3.24109}, {85.547, \
-3.24182}, {85.714, -3.24256}, {85.881, -3.24324}, {86.047, \
-3.24377}, {86.214, -3.2442}, {86.381, -3.24476}, {86.548, -3.24538}, \
{86.714, -3.2459}, {86.881, -3.24629}, {87.048, -3.24686}, {87.214, \
-3.24733}, {87.381, -3.24774}, {87.548, -3.24829}, {87.714, \
-3.24898}, {87.881, -3.24949}, {88.048, -3.24984}, {88.215, \
-3.25029}, {88.381, -3.25082}, {88.548, -3.25122}, {88.715, \
-3.25177}, {88.881, -3.25247}, {89.048, -3.25315}, {89.215, \
-3.25372}, {89.381, -3.25427}, {89.548, -3.25475}, {89.715, \
-3.25498}, {89.882, -3.25505}}

But when I use the same (except the limits) it doesn't seem to quite work exact, as I get a DT which visually seems to be lower and the plot also doesn't quite get the values on the curve. What am I doing wrong here?. The code is as follows:

n11 = 20; n12 = 35; (*Glass line limits*)
n21 = 50; n22 = 60; (*Liquid line limits*)
n31 = n11; n32 = n21; (*Region in between*)
tan1[x_] = Fit[Select[data1, n11 <= #[[1]] <= n12 &], {1, x}, x];
tan2[x_] = Fit[Select[data1, n21 <= #[[1]] <= n22 &], {1, x}, x];
pol = Fit[Select[data1, n31 <= #[[1]] <= n32 &], {1, x, x^2, x^3}, x];
infl = x /. Solve[D[pol, {x, 2}] == 0, x][[1]];
ys = {tan1[infl], tan2[infl]};
{y16, y84} = ys[[1]] + {0.16, 0.84} (ys[[2]] - ys[[1]]);
{x16, x84} = (x /. 
     Solve[{pol == #, n31 < x < n32}, x][[1]]) & /@ {y16, y84}
DT = x84 - x16 (*5.6063*)
xm = (x16 + x84)/2;
ym = (y16 + y84)/2;

Show[ListLinePlot[Select[data1, n11 <= #[[1]] <= n22 &]], 
 Graphics[{Line[{{{n11, tan1[n11]}, {n32, tan1[n32]}}, {{n31, 
       tan2[n31]}, {n22, tan2[n22]}}}], 
   Line[{{xm, tan1[xm]}, {xm, tan2[xm]}}], PointSize[0.02], 
   Point[Transpose[{{x16, x84}, {y16, y84}}]], {Dashed, 
    Line[{{x16, y16}, {x16, y16 + 0.6 (y84 - y16)}}], 
    Line[{{x84, y84}, {x84, y84 - 0.6 (y84 - y16)}}]}, 
   Arrow[{{x16 - 10, y16}, {x16, y16}}], Text["16%", {x16 - 13, y16}],
    Arrow[{{x84 + 10, y84}, {x84, y84}}], 
   Text["84%", {x84 + 13, y84}], 
   Arrow[{{xm + 10, tan1[xm] - 0.05}, {xm, tan1[xm]}}], 
   Text["1.19%", {xm + 14, tan1[xm] - 0.05}], 
   Arrow[{{xm - 10, tan2[xm] + 0.05}, {xm, tan2[xm]}}], 
   Text["1.19%", {xm - 14, tan2[xm] + 0.05}], 
   Arrow[{{x16 - 10, ym}, {x16, ym}}], 
   Text[NumberForm[x84 - x16, 3], {x84 + 7, ym - 0.03}], 
   Arrow[{{x84 + 10, ym}, {x84, ym}}]}]]

Which gives:

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ Can you clean up the data you have posted? In the beginning of the list there are many `` characters that should not be present. It will make it easier for other users (including myself!) to submit answers. Thanks! $\endgroup$ Commented Jan 19, 2021 at 14:59
  • 1
    $\begingroup$ @CATrevillian thank you! I will ! $\endgroup$
    – John
    Commented Jan 19, 2021 at 17:21

3 Answers 3

1
$\begingroup$

Here is a version where you specify the the x position, at which the height difference between the two base lines is measured:

xm = 42; (*measure position*)
n11 = 25; n12 = 35; n21 = 60; n22 = 80; n31 = 30; n32 = 50;

tan1[x_] = Fit[Select[data1, n11 <= #[[1]] <= n12 &], {1, x}, x];
tan2[x_] = Fit[Select[data1, n21 <= #[[1]] <= n22 &], {1, x}, x];
intpol = Interpolation[Select[data1, n31 <= #[[1]] <= n32 &]];

ys = {tan1[xm], tan2[xm]};
{y16, y84} = ys[[1]] + {0.16, 0.84} (ys[[2]] - ys[[1]]);
{x16, x84} = 
  x /. {FindRoot[intpol[x] == y16, {x, 35, 40}], 
    FindRoot[intpol[x] == y84, {x, 40, 45}]};
ym = (y16 + y84)/2;

Show[ListLinePlot[Select[data1, n11 <= #[[1]] <= n22 &], 
  PlotRange -> {-3.5, -2.5}], 
 Graphics[{Line[{{{n11, tan1[n11]}, {n21, tan1[n21]}}, {{n12, 
       tan2[n12]}, {n22, tan2[n22]}}}], 
   Line[{{xm, tan1[xm]}, {xm, tan2[xm]}}], PointSize[0.02], 
   Point[Transpose[{{x16, x84}, {y16, y84}}]], {Dashed, 
    Line[{{x16, y16}, {x16, y16 + 0.6 (y84 - y16)}}], 
    Line[{{x84, y84}, {x84, y84 - 0.6 (y84 - y16)}}]}, 
   Arrow[{{x16 - 10, y16}, {x16, y16}}], 
   Text["16%", {x16 - 5, y16 + 0.02}], 
   Arrow[{{x84 + 10, y84}, {x84, y84}}],
   Text["84%", {x84 + 5, y84 - 0.03}], 
   Arrow[{{xm + 10, tan1[xm]}, {xm, tan1[xm]}}], 
   Text[NumberForm[ys[[1]], 3], {xm + 6, tan1[xm] + 0.02}], 
   Arrow[{{xm - 10, tan2[xm]}, {xm, tan2[xm]}}]
   , Text[NumberForm[ys[[2]], 3], {xm - 6, tan2[xm] - 0.04}], 
   Arrow[{{x16 - 10, ym}, {x16, ym}}]
   , Text[NumberForm[x84 - x16, 3], {x84 + 7, ym - 0.03}], 
   Arrow[{{x84 + 10, ym}, {x84, ym}}]}]]

enter image description here

$\endgroup$
1
  • $\begingroup$ Daniel, thank you very much! This version is absolutely fantastic and more robust!!! $\endgroup$
    – John
    Commented Jan 19, 2021 at 21:19
3
$\begingroup$

MMA make it easy to draw complicated graphics like::

n11 = 10; n12 = 25; n21 = 62; n22 = 80; n31 = 30; n32 = 52;
tan1[x_] = Fit[Select[data, n11 <= #[[1]] <= n12 &], {1, x}, x];
tan2[x_] = Fit[Select[data, n21 <= #[[1]] <= n22 &], {1, x}, x];
pol = Fit[Select[data, n31 <= #[[1]] <= n32 &], {1, x, x^2, x^3}, x];
infl = x /. Solve[D[pol, {x, 2}] == 0, x][[1]];
ys = {tan1[infl], tan2[infl]};
{y16, y84} = ys[[1]] + {0.16, 0.84} (ys[[2]] - ys[[1]]);
{x16, x84} = (x /. 
     Solve[{pol == #, n31 < x < n32}, x][[1]]) & /@ {y16, y84}
xm = (x16 + x84)/2;
ym = (y16 + y84)/2;

Show[ListLinePlot[Select[data, n11 <= #[[1]] <= n22 &]], 
 Graphics[{Line[{{{n11, tan1[n11]}, {n32, tan1[n32]}}, {{n31, 
       tan2[n31]}, {n22, tan2[n22]}}}], 
   Line[{{xm, tan1[xm]}, {xm, tan2[xm]}}], PointSize[0.02], 
   Point[Transpose[{{x16, x84}, {y16, y84}}]], {Dashed, 
    Line[{{x16, y16}, {x16, y16 + 0.6 (y84 - y16)}}], 
    Line[{{x84, y84}, {x84, y84 - 0.6 (y84 - y16)}}]}, 
   Arrow[{{x16 - 10, y16}, {x16, y16}}], Text["16%", {x16 - 13, y16}],
    Arrow[{{x84 + 10, y84}, {x84, y84}}], 
   Text["84%", {x84 + 13, y84}], 
   Arrow[{{xm + 10, tan1[xm] - 0.05}, {xm, tan1[xm]}}], 
   Text["1.19%", {xm + 14, tan1[xm] - 0.05}], 
   Arrow[{{xm - 10, tan2[xm] + 0.05}, {xm, tan2[xm]}}], 
   Text["1.19%", {xm - 14, tan2[xm] + 0.05}], 
   Arrow[{{x16 - 10, ym}, {x16, ym}}], 
   Text[NumberForm[x84 - x16, 3], {x84 + 7, ym - 0.03}], 
   Arrow[{{x84 + 10, ym}, {x84, ym}}]}]
 
 ]

enter image description here

$\endgroup$
11
  • $\begingroup$ Daniel thank you ! Although I would also like the graphic, I am more interested in the value of DT for this data (which may not be 5) $\endgroup$
    – John
    Commented Jan 19, 2021 at 14:07
  • 1
    $\begingroup$ It is the difference of x84 and x16. $\endgroup$ Commented Jan 19, 2021 at 14:12
  • 1
    $\begingroup$ I apologize, there was a typo. I corrected it. $\endgroup$ Commented Jan 19, 2021 at 14:28
  • 1
    $\begingroup$ I also included the value of dT in the plot. $\endgroup$ Commented Jan 19, 2021 at 14:34
  • 1
    $\begingroup$ Your new data1 has a problem. The base line on the right side cuts the curve before the inflexion point. By this the whole definition of dT fails. $\endgroup$ Commented Jan 19, 2021 at 17:13
1
$\begingroup$

If you already know the y values of points on the curve and are looking for the belonging x values, the problem is much simpler. Say we have data1 and want to know what x values belongs to the know y value. As an example assume we have y=-3.1. Then, from a plot of the function, guess an x value: x1 to the left and one: x2 to the right of the given y. Then use e.g FindRoot:

x1 = 40; x2 = 45;
intpol = Interpolation[data1];
x0 = x /. FindRoot[intpol[x] == -3.1, {x, 40, 45}]
Plot[intpol[x], {x, 1, 80}, Epilog -> {Red, Point[{x0, intpol[x0]}]}]

enter image description here

$\endgroup$
4
  • $\begingroup$ Hi, daniel, no. I am still looking for DT as in the reference Figure. The only thing I know is at what temperature (x value) I want to calculate the change between the upper extrapolated line and the bottom extrapolated line (this value is 40 for data1). I still need to calculate based on this "change line" when it is about 16% or 84% of its value where in the x-axis it will be in the curve (remember the "change line" is not in the actual curve). the x-values that I am looking for can be to the right or to the left of this "change line". $\endgroup$
    – John
    Commented Jan 19, 2021 at 18:06
  • $\begingroup$ To be more clear, if I calculate the "change line" (difference between upper and bottom extrapolated lines) at say 30 when compared with 40, they will give different results at 16% and 84% in the actual curve. When I am at x=30 the change will be lower than the change if I am at x=40 and therefore the DT value will be different. So, the only thing I know is a reference x value where I want to get that change line. I hope that is more clear now $\endgroup$
    – John
    Commented Jan 19, 2021 at 18:10
  • $\begingroup$ Do I understand you correctly? You specify an x value: x0. Then you get the y values y10, y20 from the two extrapolated lines. Then from this you get the 16 and 84 percent values: y16 and y64. And from this the belonging x values of the curve x16 and x64. Can you describe where you have a problem? $\endgroup$ Commented Jan 19, 2021 at 19:17
  • $\begingroup$ The problem I have is that in your terms I don't know how to get x16 and x84 because they need to be in the extrapolated to the curve(be the curve). So, for example, your first code is absolutely perfect as it is for the first data except that you got the "change line" from a region (which resulting to be the change at x around 42) rather than a single point, like at 40, but I think that is easily fixable. The other issue with your code is that for some reason is not working with data1 correctly. So, is only needed to modify it to get "change line" at a x value and to work with data1 $\endgroup$
    – John
    Commented Jan 19, 2021 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.