I am trying to insert my calculated interpolation value back to its original position.
I have a data, in which there are some outliers.
I located the outliers within the data, deleted them and calculated interpolated value at its position.
Now i am trying to insert interpolated value back at the original position of outlier
and draw diagram same as the original one shown as example (of course without the outliers peaking at the top)
Please give me advice as to how i can implement above mentioned problem in a more smooth way.
on x-axis, idx is the time variable;
on y-axis, W
stdDev = std(W(idx))
meanValue = mean(W(idx))
zFactor = 3
outliers = find((abs(W(idx)-meanValue) > (zFactor * stdDev)) & (W(idx) > 20) )
count_outliers = length(outliers)
W(outliers) = 
x = 1:17280
x(outliers) = 
W_int = interp1(x',W,outliers)