Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
M
M le 11 Sep 2022
Commenté : Star Strider le 11 Sep 2022
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)));

Réponse acceptée

Star Strider
Star Strider le 11 Sep 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 commentaires
M
M le 11 Sep 2022
@Star Strider Can you please check the centroid question of the same shape!
I have mentioned you in the question. Thanks
Star Strider
Star Strider le 11 Sep 2022
I did, and I just posted an Answer.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by