How to define points at specific values

4 visualizaciones (últimos 30 días)
Anthony Koning
Anthony Koning el 13 de Dic. de 2021
Respondida: Image Analyst el 13 de Dic. de 2021
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

Respuestas (1)

Image Analyst
Image Analyst el 13 de Dic. de 2021
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)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by