How to extract X value given Y value from graph.
18 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Star Strider
il 11 Dic 2022
%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));
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
yv
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 Commenti
Star Strider
il 11 Dic 2022
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
Vedere anche
Categorie
Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!