필터 지우기
필터 지우기

How to find the Intersection between curves and yline ?

조회 수: 3 (최근 30일)
Jenifer NG
Jenifer NG 2022년 8월 22일
댓글: Jenifer NG 2022년 8월 22일
Hi All,
I want to find the Intersection value of these curves and yline(0.1).
Could Anyone please help me ?
This is my code:
load matlab
lst = {'0.54','0.55','0.56','0.57','yline'}
plot(m4)
yline(0.1,LineWidth=1.5,LineStyle="--")
legend(lst)
Thanks and Regard!
Han

채택된 답변

Chunru
Chunru 2022년 8월 22일
편집: Chunru 2022년 8월 22일
load matlab
lst = {'0.54','0.55','0.56','0.57','yline'}
lst = 1×5 cell array
{'0.54'} {'0.55'} {'0.56'} {'0.57'} {'yline'}
plot(m4)
yline(0.1,LineWidth=1.5,LineStyle="--")
legend(lst)
for i=1:size(m4, 2)
F = griddedInterpolant(1:size(m4, 1), m4(:, i));
[~, x0] = min(abs(m4(:, i) - 0.1)); % coarse estimate
x(i) = fsolve(@(x) F(x)-0.1, x0); % finer solution
end
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient. Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient. Equation solved at initial point. fsolve completed because the vector of function values at the initial point is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient. Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
x
x = 1×4
52.9828 59.1347 66.0000 69.8486
hold on
xline(x)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by