MATLAB: Normalize data without influence from outliers

voltage normalization

I have some time vs. voltage data that I would like to normalize, but there are some voltage outliers. The outlier peaks are meaningful and I do not want to remove them. Is there any way to normalize the data without influence from the outliers in the calculation? I want the "steady state" in my data to be around 0, and I still want to determine the Z score of those voltage peaks based on the normalization of data around the steady state.
The way I'm doing it now is gathering another set of data without the peaks, finding the mean and SD, and then manually using that to normalize the data with the peaks. It works but it is not very elegant. Is there a better way?

Best Answer

Molly,
I think the devil is in the details here, and you haven't shown us any code. The approach will depend on whether this is a one-off solution. Do you need this code to determine the outlier cutoff automatically, or you can just hard-code it this one time?
So, for example, if your voltage data are in a variable called voltageData, then you could identify the outliers with an boolean index
outlierIndex = (voltageData>137); % Hard-coded voltage outlier definition
and then use that index to exclude some data from other calculations:
meanVoltageWithoutOutlier = mean(voltageData(not(outlierIndex)));
etc.
It's difficult to give you much more advice without details from you.
Related Question