Finding local minima and maxima of DSC curves using islocalmin and islocalmax
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
DSC (Differential Scanning Calorimetry) is a thermal analysis method used in material science and chemistry to understand the thermal behavior of polymers or other organic/inorganic materials. The test is usually performed by a first heating cycle (to melt all the microcrystalline regions), followed by a cooling phase and a second heating. It is during the cooling and second heating that the crystallization and melting temperatures of a material are measured in the form of the temperature at which the heating has a local minimum or maximum.
The issue here: it is highly desirable to have a process for finding the crystallization and melting temperatures automatically, and I tried to use the islocalmin and islocalmax functions of matlab to find these values. As can be seen, multiple local minima and maxima are detected (symbols: red for minima and blue for maxima) but a lot of junk is also detected. In addition, there is an overlap in the minima and maxima, which means that, for some reason that I cannot understand, the program considers these both as minima and maxima. This is especially problematic in the section where a large naumber of points are detected nect to each other.
What I am interested in is only the local mainima/maxima pointed to by arrows. Is there a way to make the detection more specific to avoid the multiplicity seen here and reliably detect the most crucial points?
7 comentarios
Mathieu NOE
el 13 de Dic. de 2021
hello
suggestion for today - late evening
clc; clear all; format long g; close all
% [FileName,FilePath,~] = uigetfile({'*.txt*'},'MultiSelect','On');
OutFile='AllOutput.xlsx';
% IF=length(FileName);
FilePath = pwd;
FileName = {'TestForMatlab_1.txt'};
IF=length(FileName);
for ii=1:IF
InFile=char(FileName(ii));
InFilePath=fullfile(FilePath,char(FileName(ii)));
RAWW=readtable(InFilePath,'Delimiter','tab');
RAWW=table2array(RAWW); RAWW=replace(RAWW,',','.');
Data=str2double(RAWW);
InDat=fileread(InFilePath);
ISize=strfind(InDat,'Size');
Img=strfind(InDat,'mg');
SampleWeight=InDat(ISize(1)+4:Img(1)-1);
mSample(ii)=str2double(replace(SampleWeight,',','.'));
TT=Data(:,2);WW=Data(:,3)/mSample(ii); tt=Data(:,1);
% keep only positive slope (of TT) data
ind= find(diff(TT)>100/1e4);
TT=TT(ind);WW=WW(ind); tt=tt(ind);
TW=[TT WW];
% add some smoothing to avoid "multi hits" of islocalmin
WW = smoothdata(WW,'gaussian',20);
IsMinW=islocalmin((WW),'FlatSelection', 'center');
IsMaxW=islocalmax((WW),'FlatSelection', 'center');
IsMinW = find(IsMinW);
IsMinW = [IsMinW(1) IsMinW(end)]; % forget the intermediate points , keep only first and last one
IsMaxW = find(IsMaxW);
IsMaxW = [IsMaxW(1) IsMaxW(end)]; % forget the intermediate points , keep only first and last one
T_WMin=TT(IsMinW); WMin=WW(IsMinW);
T_WMax=TT(IsMaxW); WMax=WW(IsMaxW);
TabName=['43281_' num2str(ii)];
HeatingRate=gradient(TT)./gradient(tt);
%xlswrite(OutFile,TW,TabName);
subplot(2,2,[1 3])
plot(TT,WW,'k-',T_WMin,WMin,'rd',T_WMax,WMax,'bd','LineWidth',1.5,'Markersize',15)
hold on;
%zz=findchangepts(WW)
subplot(2,2,2)
%plot(tt,TT,'LineWidth',1.5)
plot(linspace(1,length(TT),length(TT)),WW,'LineWidth',1.5)
%
%plot(tt,gradient(TT),'LineWidth',1.5)
subplot(2,2,4)
plot(linspace(1,length(TT),length(TT)),HeatingRate,'LineWidth',1.5)
%plot(tt,gradient(TT))
%plot(tt,TT,'LineWidth',1.5)
hold on
TMax=max(unique(floor(TT(islocalmax(TT)))))'
TMin=min(unique(floor(TT(islocalmin(TT)))))'
%size(abs(TT-TMin)>1)
end
Respuestas (0)
Ver también
Categorías
Más información sobre Spectral Measurements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!