필터 지우기
필터 지우기

How to define points at specific values

조회 수: 4 (최근 30일)
Anthony Koning
Anthony Koning 2021년 12월 13일
답변: Image Analyst 2021년 12월 13일
Does anyone know how to define a value at a specific point for similarly to using L'Hopital's rule. The current code I have will not register values this way, and this was how our professor told us to define these values.
v = -50:10:50
if (v>=49.9 & v<=50.1)
x = .01
else x = (.01(v-50))/(exp(.1(v-50))-1)
end

답변 (1개)

Image Analyst
Image Analyst 2021년 12월 13일
Some syntax errors there in your code. Try this
v = -50:10:50
% Initialize x for outside the range.
x = 0.01 * ones(size(v));
indexesInRange = (v >= 49.9) & (v <= 50.1) % Only the last element, 50, will be in range.
% Assign a formula to x at those places where v is in range.
x(indexesInRange) = (.01 * (v(indexesInRange)-50)) ./ (exp(0.1 * (v(indexesInRange)-50)) - 1)

카테고리

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

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by