Finding the value of the below curve
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (3)
Akira Agata
il 14 Apr 2022
If you have a Signal Processing Toolbox, pulsewidth function will be a simple and effective solution.
0 Commenti
Davide Masiello
il 14 Apr 2022
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 Commenti
Star Strider
il 14 Apr 2022
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 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!