필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
M
M 2022년 9월 11일
댓글: Star Strider 2022년 9월 11일
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)));

채택된 답변

Star Strider
Star Strider 2022년 9월 11일
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
M
M 2022년 9월 11일
@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 2022년 9월 11일
I did, and I just posted an Answer.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by