Removing noise from Hysteresis loops

22 views (last 30 days)
Sadia
Sadia on 5 Jul 2019
Edited: Sadia on 24 Sep 2019
Hi, I need a help in removing noise from Hysteresis loops, I have generated code which loads multiple files(containing Force and Displacement data) one by one and plots their Hysteresis loops but i need to remove noise and the smoothening curve should fit the orginal shape, I have used a filter in following code but it distorts the orginal shape of loops which effects the area under the curve for calculation of damping.This filter works well for one data file but disfigures the other file, so I want a solution that would work for my all files. Any help would be highly appreciated.
Following is my code:
clc
clear all
projectdir = 'F:\NUST\SAMPLE 9\Measured'
dinfo = dir(fullfile(projectdir))
dinfo([dinfo.isdir]) = [] %get rid of all directories including . and ..
%nfiles = length(dinfo)
folder = 'F:\NUST\IMAGE\hysteresis';
for j = 5 :6
filename = fullfile(projectdir, dinfo(j).name)
delimiter = ';';
startRow = 1000;
endRow = 2000;
formatSpec = '%*s%*s%f%f%f%f%f%f%f%f%f%[^\n\r]';
f1 = fopen(filename, 'r')
dataArray = textscan(f1, formatSpec, endRow-startRow+1, 'Delimiter', delimiter, 'EmptyValue' ,NaN,'HeaderLines', startRow-1, 'ReturnOnError', false);
fclose(f1)
%% Allocate imported array to column variable names
Displacement = dataArray{:, 1}
Force = (dataArray{:, 2})*1000
%%%%%%%%%%%%%Plots%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure (j)
%plot(Testtime,Force)
%b=fir1(20,0.1,'low');
%[b,a]=butter(10,0.2,'low');
[b,a]=butter(10,0.2,'low');
%y1=filter(b,1,Force);%Fir
y2=filter(b,a,Force);%butter
plot(Displacement,y2)
%plot(Displacement,Force)
title(dinfo(j).name)
%title(['S1 R',sprintf('%d',j)])
xlabel('Displacement(mm)')
ylabel('Force(N)')
%saveas(h,sprintf('FIG%d.png',j));
hold on
%saveas(plot, fullfile(folder, sprintf('fig%02d.jpg', j)));
pngFileName = sprintf('Fig_%d.jpg', j);
fullFileName = fullfile(folder, pngFileName);
% Then save it
%saveas(gcf, fullFileName)
end

Accepted Answer

Star Strider
Star Strider on 6 Jul 2019
The easiest way to remove the noise is likely to fit your data to a function that describes the hysteresis.
See: Interpolation when y data is not strictly a function of x for an illustration of how to do that.
  25 Comments
Sadia
Sadia on 24 Sep 2019
Edited: Sadia on 24 Sep 2019
My pleasure.

Sign in to comment.

More Answers (0)

Categories

Find more on Visual Exploration in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!