Finding the value of the below curve

3 Ansichten (letzte 30 Tage)
Amy Topaz
Amy Topaz am 14 Apr. 2022
Beantwortet: Star Strider am 14 Apr. 2022
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????

Antworten (3)

Akira Agata
Akira Agata am 14 Apr. 2022
If you have a Signal Processing Toolbox, pulsewidth function will be a simple and effective solution.

Davide Masiello
Davide Masiello am 14 Apr. 2022
Hi again @Amy Topaz XD
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])

Star Strider
Star Strider am 14 Apr. 2022
Using findpeaks
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)
Width k1(1,:) = 0.050004 Width k1(2,:) = 0.053169
.

Kategorien

Mehr zu Time Series finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by