How to define points at specific values
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Image Analyst
am 13 Dez. 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)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Whos finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!