¸÷λ´óÉñ£¬ÎÒÓÐÒ»·ÝpgmÎļþ£¬Í¨¹ýimportdataת³ÉÊý¾Ý½øÐзÖÎö
µ«ÊÇÎÒÏÖÔÚÖ»ÄâºÏ³öÒ»¸ö¸ß˹ͼÏñ£¬Ôõô²ÅÄÜÔÚÎҵijÌÐò»ù´¡ÉϱàÒë¶à¸öÄâºÏÄØ£¿
ÏÖ¸ø³öÎҵijÌÐòºÍͼÏñ
function [ OutArr ] = Graph( NameFile, PlotOut, Angl)
InputVar = nargin;
DAT=importdata(NameFile);
if (InputVar>2)
Angle = Angl;
else
Angle = 0;
end
DAT = imrotate(DAT, Angle, 'nearest');
IMG=medfilt2(DAT,[3,3]);
[md, nd] = size(IMG);
disp({'M=' ,md , 'N=', nd});
Noise = mean(IMG(1:40));
i=0:nd-1;
X2D=i;
if (InputVar >1)&(PlotOut == 'Y')
Hendl=figure;
imagesc(IMG);
end
[Max, INmax] = max(IMG);
[Max, IMmax] = max(Max);
Nmax = INmax(IMmax);
disp({'Nmax = ', Nmax; 'Mmax = ', IMmax});
Top=Nmax+20;
Bottom=Nmax-20;
Y2D(i+1)=mean(IMG(Bottom:Top,i+1));
Y2D = Y2D-Noise;
Y2D = Y2D/max(Y2D);
gaussEqn = 'a*exp(-((x-b)/c)^2)+d';
startPoints = [1, IMmax, 1, 0];
f = fit(X2D', Y2D', gaussEqn, 'Start', startPoints);
FitGaussD = f(X2D);
Cint = confint(f, 0.95);
OutArr = [f.c; Cint(:,3)];
disp({'averge = ', f.b; 'Sigma = ', f.c});
if (InputVar >1)&(PlotOut == 'Y')
Hendl = figure;
ax = gca;
ax.XTickMode = 'manual'; ax.XTick = 0:25:nd; ax.XLim = [0, nd];
ax.YTickMode = 'manual'; ax.YTick = 0:0.1:1; ax.YLim = [0, 1];
hold on;
plot(X2D, Y2D, ':', 'LineWidth', 2);
plot(X2D, FitGaussD, 'r', 'LineWidth', 2);
legend('§¿§Ü§ã§á§Ö§â§Ú§Þ§Ö§ß§ä§Ñ§Ý§î§ß§í§Ö §Õ§Ñ§ß§ß§í§Ö','§¡§á§á§â§à§Ü§ã§Ú§Þ§Ñ§è§Ú§ñ');
Pred = predint(f,X2D,0.95,'functional','on');
strmax = {['center of mass = ', num2str(f.b, 3)], ['{\sigma} = ', num2str(f.c, 5)]};
text(f.b, 0.2,...
strmax,'HorizontalAlignment','center', 'FontSize',14);
xlabel('vertical axis pixel', 'FontSize',12,'FontWeight','bold');
ylabel('intensity', 'FontSize',12,'FontWeight','bold');
grid on;
hold off;
end
![matlab ¶à·å¸ß˹ÄâºÏ]()
ÆÁÄ»¿ìÕÕ 2016-06-17 ÏÂÎç4.52.41.png |