Today, I tried to fit T2 distribution with gaussian distributions at every depth.
Summary:
1. I find peaks at every depth. But there are 1 or 2 or 3 or more peaks at some depth. Some of them are really small though.
2. If there are more than 2 peaks at one depth, I decide to delete some of them and keep two peaks at most.
3. If there are only 1 peak at one depth, I copy it so that every depth has two peaks.
4. I also find that there are no peaks at some depth. I finally find that it is because the shape of T2 distribution at some depth are like this:
So I add the first and last point value to data matrix as the peaks at some depth.
5. Finally there are two peaks at every depth.
6. I set initial values for iteration when fitting. Because there may cause calculating problems when fitting in Matlab if the initial values are not similar to the results. So setting initial values for iteration is very important.
The following are codes I write today.
%% whole depth
% find peaks
for i=1:4256
for j=2:63
if T2distri(i,j-1)<T2distri(i,j) && T2distri(i,j)>T2distri(i,j+1)
p(i,j)=T2distri(i,j);
end
end
end
[row,col,v]=find(p);
col1=col+1;
p2=[row,col1,v]; % ascending it by row
% if there are more than two peaks at one depth, delete some of them
p3=p2;
for i=1:7977 % change the number till the end
if p3(i,1)==p3(i+1,1) && p3(i+1,1)==p3(i+2,1)
if p3(i,3)<p3(i+1,3) && p3(i,3)<p3(i+2,3)
p3(i,:)=[];
else if p3(i+1,3)<p3(i,3) && p3(i+1,3)<p3(i+2,3)
p3(i+1,:)=[];
else
p3(i+2,:)=[];
end
end
end
end
% now there is only one or two peaks at every depth
%% adjust two peaks at every depth
p4=p3;
for i=2:8483 % change the number till the end
if p4(i,1)~=p4(i-1,1) && p4(i,1)~=p4(i+1,1)
p4=[p4(1:i,:);p4(i,:);p4(i+1:end,:)];
end
end
% but there are some missing depth
%% add missing depth
p5=p4;
for i=2:8512
if p5(i,1)>=p5(i-1,1)+2
p5=[p5(1:i-1,:);[p5(i-1,1)+1,1,T2distri(p5(i-1,1)+1,1)];
[p5(i-1,1)+1,64,T2distri(p5(i-1,1)+1,64)];p5(i:end,:)];
end
end
%% set initial values for iteration
for i=1:8512,
beta0(i,:)=[0.01;1;p5(i,3)];
end
Tomorrow, I will try to finish the following part of fitting T2 distribution at every depth.
1. I find peaks at every depth. But there are 1 or 2 or 3 or more peaks at some depth. Some of them are really small though.
ReplyDelete>>>> if magnitude of 3 peak is very small... ignore the third peak
2. If there are more than 2 peaks at one depth, I decide to delete some of them and keep two peaks at most.
>>>> ignore all depths with 3 peaks where the third peak is large and cannot be ignored...we will develop the predictive method only for 2 peaks... once we master the 2 peak prediction we will think about the three peak
3. If there are only 1 peak at one depth, I copy it so that every depth has two peaks.
>>>>> do not copy.... if the mean of the single peak distribution is close to most of the first peaks in other depth then make mu, sigma, and magnitude of second peak to be all zeros.....
>>>>> if the mean of the single peak distribution is close to most of the second peaks in other depth then make mu, sigma, and magnitude of first peak to be all zeros.....
4. I also find that there are no peaks at some depth. I finally find that it is because the shape of T2 distribution at some depth are like this:
>>>>>> ignore these depths
ok, i will follow it.
Delete