1
$\begingroup$

I have a question to plot out the standard deviation for my graphs:
How can I plot out the SD values in each point such that the max and min will start from 0 and not an offset standard deviation (SD) values indicated on the graph enter image description here

I think that my first plot (first graph) is wrong as the raw signal that I have it does not have a huge variation at the beginning of the experiment (see second graph). enter image description here

Percentgaittime={0.591716, 1.18343, 1.77515, 2.36686, 2.95858, 3.5503, 4.14201, 4.73373, 5.32544, 5.91716, 6.50888, 7.10059, 7.69231, 8.28402, 8.87574, 9.46746, 10.0592, 10.6509, 11.2426, 11.8343, 12.426, 13.0178, 13.6095, 14.2012, 14.7929, 15.3846, 15.9763, 16.568, 17.1598, 17.7515, 18.3432, 18.9349, 19.5266, 20.1183, 20.7101, 21.3018, 21.8935, 22.4852, 23.0769, 23.6686, 24.2604, 24.8521, 25.4438, 26.0355, 26.6272, 27.2189, 27.8107, 28.4024, 28.9941, 29.5858, 30.1775, 30.7692, 31.3609, 31.9527, 32.5444, 33.1361,33.7278, 34.3195, 34.9112, 35.503, 36.0947, 36.6864, 37.2781, 37.8698, 38.4615, 39.0533, 39.645, 40.2367, 40.8284, 41.4201,42.0118, 42.6036, 43.1953, 43.787, 44.3787, 44.9704, 45.5621, 46.1538, 46.7456, 47.3373, 47.929, 48.5207, 49.1124, 49.7041, 
50.2959, 50.8876, 51.4793, 52.071, 52.6627, 53.2544, 53.8462, 
54.4379, 55.0296, 55.6213, 56.213, 56.8047, 57.3964, 57.9882, 
58.5799, 59.1716, 59.7633, 60.355, 60.9467, 61.5385, 62.1302, 
62.7219, 63.3136, 63.9053, 64.497, 65.0888, 65.6805, 66.2722, 
66.8639, 67.4556, 68.0473, 68.6391, 69.2308, 69.8225, 70.4142, 
71.0059, 71.5976, 72.1893, 72.7811, 73.3728, 73.9645, 74.5562, 
75.1479, 75.7396, 76.3314, 76.9231, 77.5148, 78.1065, 78.6982, 
79.2899, 79.8817, 80.4734, 81.0651, 81.6568, 82.2485, 82.8402, 
83.432, 84.0237, 84.6154, 85.2071, 85.7988, 86.3905, 86.9822, 87.574, 
88.1657, 88.7574, 89.3491, 89.9408, 90.5325, 91.1243, 91.716, 
92.3077, 92.8994, 93.4911, 94.0828, 94.6746, 95.2663, 95.858, 
96.4497, 97.0414, 97.6331, 98.2249, 98.8166, 99.4083, 100.}
    
 
NormResC1Asc1 = {0., 0.000871409, -0.000740505, -0.00134163, -0.00125942, -0.00052254, 0.00112623, 0.000823583, 0.000802469, 0.00159639,0.00448126, 0.00411105, 0.00543972, 0.00489886, 0.00384889, 0.00542814, 0.00710673, 0.00598996, 0.00711033, 0.00883733, 0.00914232, 0.00852809, 0.0107261, 0.00855188, 0.00679089,0.00792223, 0.0086907, 0.00937034, 0.00964927, 0.0111331, 0.0140438,0.0199721, 0.0246155, 0.0332378, 0.051366, 0.0742839, 0.1064, 0.15128, 0.201599, 0.262696, 0.329243, 0.398985, 0.465571, 0.536221,0.609329, 0.685823, 0.761802, 0.8414, 0.911659, 0.977647, 1.04094, 1.09193, 1.13431, 1.18174, 1.2516, 1.32134, 1.39694, 1.46957, 1.53577, 1.60624, 1.66916, 1.70144, 1.72273, 1.74696, 1.77908, 1.814, 1.85053, 1.87412, 1.90048, 1.92134, 1.93887, 1.95001, 1.96512, 1.96056, 1.96346, 1.96428, 1.95449, 1.93845, 1.9243, 1.89434, 1.87925, 1.87431, 1.86644, 1.86, 1.84797, 1.82349, 1.80828, 1.79432, 1.77043, 1.72446, 1.68728, 1.64169, 1.59797, 1.5465, 1.49774, 1.45594, 1.4255, 1.39835, 1.37312, 1.36832, 1.36181, 1.36442, 1.35927, 1.33873, 1.31037, 1.29284, 1.26308, 1.24343, 1.21745, 1.17917, 1.14398, 1.11738, 1.09264, 1.06801, 1.04273, 1.01814, 0.991142, 0.970073, 0.951085, 0.931859, 0.912559, 0.890691, 0.868159, 0.85702, 0.847986, 0.843135, 0.838643, 0.832466, 0.830572, 0.826032, 0.814687, 0.808274, 0.800308, 0.790738, 0.782522, 0.769899, 0.757053, 0.743036, 0.726614, 0.709825, 0.690833, 0.672784, 0.654336, 0.636639, 0.625245, 0.616709, 0.607173, 0.601512, 0.596416, 0.586862, 0.576896, 0.568696, 0.557097, 0.550053, 0.53843, 0.525168, 0.511005, 0.497228, 0.480725, 0.466692, 0.446603, 0.426976, 0.407396, 0.389219, 0.371394, 0.353962, 0.337503, 0.321913, 0.309144}
    
     
NormResC1Asc2= {0., -0.00463601, -0.00683428, -0.00390607, 0.000367441,0.00320625, 0.0089447, 0.0143239, 0.0218172, 0.0260871, 0.026873, 0.0269342, 0.0265424, 0.0284897, 0.0282533, 0.0295213, 0.0320477, 0.0345993, 0.0422748, 0.0513945, 0.0606219, 0.070095, 0.0844906, 0.10046, 0.118654, 0.139828, 0.157375, 0.176484, 0.199233, 0.224248, 0.25413, 0.28797, 0.325762, 0.365045, 0.408375, 0.452922, 0.496558, 0.542801, 0.584341, 0.620449, 0.652293, 0.682289, 0.713376, 0.741512, 0.76776, 0.797997, 0.830404, 0.85925, 0.888021, 0.918696, 0.945173, 0.968696, 0.992999, 1.0116, 1.02261, 1.03377, 1.05325, 1.06956, 1.08246, 1.10057, 1.1215, 1.14386, 1.16751, 1.2005, 1.22458, 1.25248, 1.27889, 1.29383, 1.30232, 1.30679, 1.30262, 1.29932, 1.29325, 1.28014, 1.25872, 1.24713, 1.23259, 1.22369, 1.2135, 1.1936, 1.1759, 1.15637, 1.14176, 1.11292, 1.08733, 1.05505, 1.02753, 1.00353, 0.966075, 0.933721, 0.907243, 0.884606, 0.862536, 0.833083, 0.805812, 0.777462, 0.756732, 0.738711, 0.71982, 0.698264, 0.674954, 0.65101, 0.626243, 0.600121, 0.576264, 0.55032, 0.524915, 0.500051, 0.479191, 0.463178, 0.450019, 0.440994, 0.431436, 0.424989, 0.420254, 0.415529, 0.410082, 0.40431, 0.400778, 0.398645, 0.394126, 0.38353, 0.371454, 0.358892, 0.347324, 0.336793, 0.324772, 0.312889, 0.300652, 0.289391, 0.280647, 0.272934, 0.263288, 0.251555, 0.239668, 0.225725, 0.214904, 0.206203, 0.194028, 0.17972, 0.165406, 0.153531, 0.139882, 0.128162, 0.120311, 0.110714, 0.101462, 0.0909281, 0.0847471, 0.0795208, 0.0734919, 0.067886, 0.0597215, 0.0512292, 0.0392019, 0.0308578, 0.025025, 0.0175671, 0.0112968, 0.00525914, -0.00129158, -0.00639391, -0.00860829, -0.0091759, -0.0108808, -0.0113758, -0.0133053, -0.01256, -0.00781968}
    

NormResC2Asc1= {0., -0.000413181, 0.00220723, 0.00426789, 0.00602494, 
0.00677223, 0.00756772, 0.0074908, 0.009106, 0.00788936, 0.00682902, 
0.00611131, 0.00720546, 0.0105889, 0.0141865, 0.0172424, 0.0200145, 
0.0241169, 0.0288378, 0.0298885, 0.032149, 0.0340458, 0.036915,
0.0423055, 0.0495934, 0.0556933, 0.0630704, 0.0764393, 0.0883792,
0.104457, 0.121796, 0.139617, 0.153674, 0.172188, 0.189452, 0.207804, 
0.227732, 0.24717, 0.268627, 0.300658, 0.334622, 0.37111, 0.414429, 
0.468335, 0.525668, 0.590787, 0.656239, 0.716262, 0.782697, 0.847396, 0.901097, 0.947387, 0.984359, 1.01899, 1.05981, 1.10881, 1.15076, 
1.19628, 1.25961, 1.32766, 1.39752, 1.46449, 1.51884, 1.56601, 
1.60769, 1.64225, 1.65851, 1.67623, 1.70822, 1.74614, 1.77228,
1.80287, 1.83836, 1.86757, 1.9014, 1.92114, 1.90583, 1.89246, 1.87984, 1.86693, 1.85152, 1.82916, 1.80917, 1.79047, 1.77034, 
1.74984, 1.7306, 1.70442, 1.68531, 1.66426, 1.6246, 1.58603, 1.55539,
1.53111, 1.49312, 1.45477, 1.4083, 1.36957, 1.33886, 1.30745,
1.27649, 1.2565, 1.23757, 1.22113, 1.19621, 1.16869, 1.14693,
1.11991, 1.08172, 1.04074, 1.00755, 0.983868, 0.962412, 0.929364,
0.899639, 0.878907, 0.859796, 0.844274, 0.824928, 0.811923, 0.808778, 
0.810118, 0.808959, 0.803905, 0.801119, 0.794846, 0.789068, 0.779784, 
0.770125, 0.759239, 0.754489, 0.749345, 0.7444, 0.74036, 0.732717,
0.725308, 0.716205, 0.704226, 0.692984, 0.686264, 0.677772, 0.668642, 
0.661061, 0.652723, 0.644112, 0.636243, 0.618104, 0.596395, 0.575555, 
0.556985, 0.538922, 0.518694, 0.497542, 0.476761, 0.457425, 0.43507, 
0.404895, 0.372304, 0.340365, 0.308531, 0.283121, 0.259736, 0.23839, 
0.220333, 0.20847, 0.198072, 0.188096, 0.181486, 0.173802}
        
$\endgroup$
3
  • 1
    $\begingroup$ Basically I was trying to plot the upper and lower bound together with the mean graph. Thank you $\endgroup$
    – Boajj04
    Apr 11, 2022 at 10:54
  • $\begingroup$ Please load the (timeseries?) data from which you have calculated the mean and perhaps these other lists. Also explain what these data lists represent. Are you calculating the element-by-element mean of the three lists and would you like to calculate SD for them as well? Thanks. $\endgroup$
    – Syed
    Apr 11, 2022 at 13:15
  • $\begingroup$ Yup I wanted to calculate the element by element, and the timeseries is added $\endgroup$
    – Boajj04
    Apr 11, 2022 at 13:44

1 Answer 1

2
$\begingroup$

Let's start out by grouping the data by moment in time.

NormRes = Transpose[{NormResC1Asc1, NormResC1Asc2, NormResC2Asc1}];

We can then calculate the mean and standard deviation of the data at each moment in time using Map[]

NormResMean = Map[Mean, NormRes];
NormRezStDev = Map[StandardDeviation, NormRes];

Then plot using Percentgaittime as the time coordinate.

ListLinePlot[
 {Transpose[{Percentgaittime, NormResMean}],
  Transpose[{Percentgaittime, NormResMean + NormRezStDev}],
  Transpose[{Percentgaittime, NormResMean - NormRezStDev}]},
 PlotLegends -> {"Mean", "Mean+StDev", "Mean-StDev"}]

enter image description here

$\endgroup$

Your Answer

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

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