我被认为是MATLAB的初学者。 我需要找到一些图形的FWHM,这些图形在峰值时相当嘈杂且不一致。 下面是我的基本代码,在一些来自stackoverflow用户的代码的帮助下。如何找到噪声图的平均值以获得FWHM?
DD11=dicomrt_read3ddose(1,'waterphantom50x1mm15x1cmslabs500Mill_2.5cmFS_20cmx20cmDE.3ddose');
%plot first function
a=squeeze(DD11(100,:,55));
figure;
plot(a);
hold on;
%find half of maximum value
max(a);
halfAmax=0.5*(max(a));
%plot straight line across the first function
x2=[1:1:200];
LineValue=halfAmax;
plot(x2,LineValue);
%Find the starting indices of those segments of consecutive points that exceed LineValue
idx = find(diff(a >= LineValue))
hold on;
x3 = x2(idx) + (LineValue - a(idx)) .* (x2(idx+1) - x2(idx)) ./ (a(idx+1) - a(idx))
plot(x3, LineValue, 'go', [x2(1) x2(end)], LineValue*[1 1], 'k:');
%distance of the two points
fwhmwidth=[x3(end)-x3(1)].*0.1
hold on;
%plot first function
b=squeeze(DD11(100,:,7));
plot(b);
hold on;
%find half of maximum value
max(b);
halfAmax=0.5*(max(b));
%plot straight line across the first function
x2=[1:1:200];
LineValue=halfAmax;
plot(x2,LineValue);
%Find the starting indices of those segments of consecutive points that exceed LineValue
idx = find(diff(b >= LineValue))
hold on;
x3 = x2(idx) + (LineValue - b(idx)) .* (x2(idx+1) - x2(idx)) ./ (b(idx+1) - b(idx))
plot(x3, LineValue, 'go', [x2(1) x2(end)], LineValue*[1 1], 'k:');
%distance of the two points
fwhmwidth=[x3(end)-x3(1)].*0.1
我希望那个; (1)我可以找到这些峰值的平均值,因为它们很嘈杂 (2)我可以更好地解释我上面的代码,如下所示;
%Find the starting indices of those segments of consecutive points that exceed LineValue
idx = find(diff(b >= LineValue))
hold on;
x3 = x2(idx) + (LineValue - b(idx)) .* (x2(idx+1) - x2(idx)) ./ (b(idx+1) - b(idx))
plot(x3, LineValue, 'go', [x2(1) x2(end)], LineValue*[1 1], 'k:');
非常感谢。