Matlab的.m程式,一鍵提取滞回曲線的骨架曲線點
-----------------------------
[ColMaxValue,LineMax]=max(A); %擷取各列最大值所在行号LineMax(1*n向量),ColMaxValue為各列的最大值(1*n向量),n為A的列數
[ColMinValue,LineMin]=min(A); %擷取各列最小值所在行号LineMin
FramePointMax=A(LineMax(2),:); %第2列為荷載列
FramePointMin=A(LineMin(2),:);
FramePointsPostive(k,:)=FramePointMax; %骨架曲線點儲存在矩陣FramePoints中
FramePointsNegative(k,:)=FramePointMin;
elseif outdata(LineNum,1)>=0 %僅正半周,僅一個最大值----------------------------------------------------
[ColMaxValue,LineMax]=max(A); %擷取最大值行号LineMax
FramePointMax=A(LineMax(2),:);
FramePointsPostive(k,:)=FramePointMax;
else %有負半周,有最大值和最小值----------------------------------------------------
[ColMinValue,LineMin]=min(A); %擷取最小值行号LineMin
FramePointMin=A(LineMin(2),:);
FramePointsPostive(k,:)=FramePointMax;
FramePointsNegative(k,:)=FramePointMin;
end;
end;
end;
%---------------------------------------比較最大位移,删除骨架曲線中同一荷載級的較小骨架點---------------------------------------------------
for k=LoopNum:-1:2
A=LoopCircles{k};
B=LoopCircles{k-1};
[ColMaxValueA,LineMaxA]=max(A); %擷取各列最大值所在行号LineMax(1*n向量),ColMaxValue為各列的最大值(1*n向量),n為A的列數
[ColMinValueA,LineMinA]=min(A); %擷取各列最小值所在行号LineMin
[ColMaxValueB,LineMaxB]=max(B); %擷取各列最大值所在行号LineMax(1*n向量),ColMaxValue為各列的最大值(1*n向量),n為A的列數
[ColMinValueB,LineMinB]=min(B); %擷取各列最小值所在行号LineMin
if abs(ColMaxValueA(1)-ColMaxValueB(1))<4; %判斷為同一荷載級,容差取為4mm
if ColMaxValueA(2)
FramePointsPostive(k,:)=[];
else
FramePointsPostive(k-1,:)=[];
end;
end;
if abs(ColMinValueA(1)-ColMinValueB(1))<4;
if ColMinValueA(2)
FramePointsNegative(k-1,:)=[];
else
FramePointsNegative(k,:)=[];
end;
end;
end;
dlmwrite('FrameCurve.txt',FramePointsPostive,'-append','delimiter','\t','
newline','pc','precision','%.2f')
dlmwrite('FrameCurve.txt',FramePointsNegative,'-append','delimiter','\t','newline','pc','precision','%.2f')