Finding the value of the below curve
1 次查看(过去 30 天)
显示 更早的评论
z1 = [0.00008 0.009]';
a11 = -2:0.002:2;
k1 = atan(((0.02 + a11)./z1)) + atan((0.03 - a11)./z1);
plot(a11,k1(1,:),'-k',a11,k1(2,:),'-r')
%%How to find the full width at half maximum for k1????
0 个评论
回答(3 个)
Akira Agata
2022-4-14
If you have a Signal Processing Toolbox, pulsewidth function will be a simple and effective solution.
0 个评论
Davide Masiello
2022-4-14
See below. I have done the procedure for one curve only, so to make it clearer.
z1 = [0.00008 0.009]';
a11 = -1:0.001:1;
k1 = atan(((0.01/2 + a11)./z1)) + atan((0.01/2 - a11)./z1);
% Find max values for both curves
[~,idx_k1] = max(k1,[],2);
% Width at half max for first curve
half_max = k1(1,idx_k1(1))/2;
xq(1) = interp1(k1(1,1:idx_k1),a11(1:idx_k1), half_max);
xq(2) = interp1(k1(1,idx_k1+1:end), a11(idx_k1+1:end), half_max);
% Width at half max
L = xq(2)-xq(1);
% Plotting
plot(a11,k1(1,:),'-k',a11(idx_k1(1)),k1(1,idx_k1(1)),'*b')
hold on
plot(xq, [1 1]*half_max, 'r')
plot(xq, [1 1]*half_max, 'xr', 'MarkerSize',10)
text(xq(1)+L/2,0.9*half_max,'L','HorizontalAlignment','center','Color','red')
axis([-0.05 0.05 -inf +inf])
0 个评论
Star Strider
2022-4-14
z1 = [0.00008 0.009]';
a11 = -2:0.002:2;
k1 = atan(((0.02 + a11)./z1)) + atan((0.03 - a11)./z1);
[pk1,loc1,wdth1] = findpeaks(k1(1,:),a11, 'WidthReference','halfheight');
[pk2,loc2,wdth2] = findpeaks(k1(2,:),a11, 'WidthReference','halfheight');
fprintf('Width k1(1,:) = %.6f\nWidth k1(2,:) = %.6f\n',wdth1,wdth2)
.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!