How to know the x projection in this function if the y is known?

2 visualizzazioni (ultimi 30 giorni)
How to know the x projection in this function if the y is known? For example If the y = 0.4 what is the x?
xA = 0;
xB = 1;
xf = 1
x = linspace(0, xf, xf*1e4 + 1);
a = 9.2; %
c = 0.5; % center of function
Y = sigmf(x, [a c]).*((0 <= (x - xA)) & ((x - xA) < (xB - xA)));

Risposta accettata

Star Strider
Star Strider il 11 Set 2022
Use interp1 to interpolate —
xA = 0;
xB = 1;
xf = 1;
x = linspace(0, xf, xf*1e4 + 1);
a = 9.2; %
c = 0.5; % center of function
Y = sigmf(x, [a c]).*((0 <= (x - xA)) & ((x - xA) < (xB - xA)));
yq = 0.4;
xq = interp1(Y, x, yq)
xq = 0.4559
figure
plot(x, Y)
hold on
plot(xq, yq, 'sr')
hold off
grid
text(xq, yq, sprintf(' \\leftarrow, (%.2f, %.2f)', xq, yq), 'Horiz','left', 'Vert','middle')
.
  4 Commenti
M
M il 11 Set 2022
@Star Strider Can you please check the centroid question of the same shape!
I have mentioned you in the question. Thanks

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Interpolation in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by