How to define points at specific values
조회 수: 4 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (1개)
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)
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!