필터 지우기
필터 지우기

How to extract X value given Y value from graph.

조회 수: 18 (최근 30일)
ulas can ozak
ulas can ozak 2022년 12월 11일
댓글: Star Strider 2022년 12월 11일
I want to find x value given y value,
%Finding X value with known Y value on plot
clc; clear all; close all;
x= 0:0.01:5;
y= [0.2 0.4 0.7 0.9 1.0]
[X, Y] = meshgrid(x);
A = ((1)./(1+5.*((x-5).^2)));
B = (2.^(-x));
C = ((2.*x)./(x+5));
plot(x, A, 'DisplayName', 'A')
hold on
plot(x, B, 'DisplayName', 'B')
hold on
plot(x, C, 'DisplayName', 'C')
hold on
title('A - B - C')
legend
  댓글 수: 2
KSSV
KSSV 2022년 12월 11일
Read about interp1
ulas can ozak
ulas can ozak 2022년 12월 11일
Can you share an aplication sample.

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

답변 (1개)

Star Strider
Star Strider 2022년 12월 11일
%Finding X value with known Y value on plot
clc; clear all; close all;
x= 0:0.01:5;
y= [0.2 0.4 0.7 0.9 1.0]
y = 1×5
0.2000 0.4000 0.7000 0.9000 1.0000
[X, Y] = meshgrid(x);
A = ((1)./(1+5.*((x-5).^2)));
B = (2.^(-x));
C = ((2.*x)./(x+5));
ABC = [A; B; C];
for k = 1:size(ABC,1)
xv(k,:) = interp1(ABC(k,:), x, y);
yv(k,:) = interp1(x, ABC(k,:), xv(k,:));
end
xv
xv = 3×5
4.1055 4.4523 4.7072 4.8509 5.0000 2.3219 1.3219 0.5146 0.1520 0 0.5556 1.2500 2.6923 4.0909 5.0000
yv
yv = 3×5
0.2000 0.4000 0.7000 0.9000 1.0000 0.2000 0.4000 0.7000 0.9000 1.0000 0.2000 0.4000 0.7000 0.9000 1.0000
plot(x, A, 'DisplayName', 'A')
hold on
plot(x, B, 'DisplayName', 'B')
hold on
plot(x, C, 'DisplayName', 'C')
hold on
plot(xv, yv, 's', 'DisplayName','Intersections')
title('A - B - C')
legend('Location','eastoutside')
plot(x,ones(numel(x),1)*y, ':k', 'DisplayName','Y Vector')
axis('padded')
.
  댓글 수: 2
ulas can ozak
ulas can ozak 2022년 12월 11일
Thank you very much. Best wishes.
Star Strider
Star Strider 2022년 12월 11일
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by