I'm trying to find out the value of x when y = 22948. I've tried the intersect and find command but can't get it to work.
clear vars
clear
clc
% Experimental Data
cpm = [45896,36896,32296,27696,20896,16396,11896,8396];
thickness = [0,1.6,2.4,3.3,4.9,6.4,9.5,12.7];
half_cpm = 22948;
% Plot data
figure()
t=plot(thickness,cpm)
hold on % Retain current figure
yline(half_cpm) % Add horizontal line at I = I0/2
xlabel('Thickness of lead (mm)');
ylabel('Background Corrected Counts per Minute (cpm)');
title('Effectiveness of lead at attenuating gamma radiation.');

 채택된 답변

Star Strider
Star Strider 2020년 10월 12일

1 개 추천

Add this:
thick_half_cpm = interp1(cpm, thickness, half_cpm);
to get the intersection, so the full code becomes:
% Experimental Data
cpm = [45896,36896,32296,27696,20896,16396,11896,8396];
thickness = [0,1.6,2.4,3.3,4.9,6.4,9.5,12.7];
half_cpm = 22948;
thick_half_cpm = interp1(cpm, thickness, half_cpm);
% Plot data
figure()
t=plot(thickness,cpm);
hold on % Retain current figure
yline(half_cpm) % Add horizontal line at I = I0/2
plot(thick_half_cpm, half_cpm, 'pg', 'MarkerSize',15)
hold off
xlabel('Thickness of lead (mm)');
ylabel('Background Corrected Counts per Minute (cpm)');
title('Effectiveness of lead at attenuating gamma radiation.');
The intersection is plotted with a green pentagram.

댓글 수: 2

William Alderson
William Alderson 2020년 10월 12일
Perfect thank you!
Star Strider
Star Strider 2020년 10월 12일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

릴리스

R2020a

태그

질문:

2020년 10월 12일

댓글:

2020년 10월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by