smoothing a highly scattered data or making a fit through it
4 views (last 30 days)
Show older comments
hi i have data having too much scatter and i tried to smooth it using the loess and a span of 0.95 which does a good job but what it also does is it suppreses the value at the begininng by lowering down the curve in the initial stage, i am guessing it is due to the large span and when i try to decrease the span the scatter in the mid x values remains still high(doesnt produce a smooth curve)can someone please suggest me a better way to go around this problem or if it is possible to make a fit. also is it possible to get the goodness of fit with this data? i am uploading the data and the graph that i get and the code i wrote. to find ei and di, i made another interpolation function as i have to lastly make an avergae of other tests too. (please dont mind the code i am fairly new at it)![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/226462/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/226462/image.jpeg)
thanks in advance and i really appreciate the effort.
clc;
format long;
clear;
%%
%This function will import the data into a table format.%
opts = detectImportOptions('20sec.dat','NumVariables',8);
%%opts.VariableUnitsLine=5;
opts.VariableNamesLine=4;
opts.DataLine=6;
data = readtable('20sec.dat',opts);
data.Properties.VariableNames{'Var1'}='time0';
data.Properties.VariableNames{'Var2'}='temperature';
data.Properties.VariableNames{'Var3'}='Thermo1';
data.Properties.VariableNames{'Var4'}='Thermo2';
data.Properties.VariableNames{'Var5'}='Thermo3';
data.Properties.VariableNames{'Var6'}='strain0';
data.Properties.VariableNames{'Var7'}='force';
data.Properties.VariableNames{'Var8'}='Axial_Displacement';
time1=data.time0(data.time0>382& data.strain0>-0.0129& data.temperature>629);
strain1=data.strain0(data.time0>382& data.strain0>-0.0129 &data.temperature>629);
%%
strain=strain1-strain1(1);
strain=strain.*(-1);
b=strain<=0.01;
e=strain(b);
time=time1-time1(1);
time=time./3600;
t=time(b);
%%instantaneous rate
d=gradient(e,t); %d is the gradient or derivative
d1y=smooth(e,d,0.95,'loess');
[ei,di]= interpolate(e,d1y);
mincreeprate=min(di);
0 Comments
Answers (0)
See Also
Categories
Find more on Data Preprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!