How to assign predetermined values for points of discontinuity

1 次查看(过去 30 天)
Does anyone know how I would be able to assign a pretermined value for a point of discontinuity? I am currently working on writing a script to determine values at cetrain points of v, and with the exception of v=10, the script is working just fine. at v=10, we are left with the indeterminate of 0/0. Using basic calculus and applying L'Hopital's rule, we can determine that at v=10, the output is .1. However, I don't know how to add this to my script, and am still getting the output of NaN. Any help on how to fix this would be appreciated.
v = 0:5:50
a_n=(0.01.*(10-v))./(exp((10-v)./10)-1)
b_n= exp(-v./80)./8
if v == 10
then a_n = 0.1
end

采纳的回答

Matt J
Matt J 2021-12-9
编辑:Matt J 2021-12-9
v0 = 10+(-3:0.01:3)*1e-8;
v=v0;
a_n=(0.01.*(10-v))./expm1((10-v)./10);
idx=abs(v-10)<1e-8;
v=v(idx);
a_n(idx)=(0.01)./(0.1+(10-v)./200); %use Taylor approx
plot(v0,a_n,'x')

更多回答(2 个)

Walter Roberson
Walter Roberson 2021-12-9
v = 0:5:50
a_n=(0.01.*(10-v))./(exp((10-v)./10)-1)
b_n= exp(-v./80)./8
a_n(v == 10) = 0.1;

Steven Lord
Steven Lord 2021-12-9
编辑:Steven Lord 2021-12-9
v = 0:5:50
v = 1×11
0 5 10 15 20 25 30 35 40 45 50
a_n=(0.01.*(10-v))./(exp((10-v)./10)-1)
a_n = 1×11
0.0582 0.0771 NaN 0.1271 0.1582 0.1931 0.2313 0.2724 0.3157 0.3609 0.4075
a_n = fillmissing(a_n, 'constant', 0.1) % Fill missing values (NaN) in a_n with a constant 0.1
a_n = 1×11
0.0582 0.0771 0.1000 0.1271 0.1582 0.1931 0.2313 0.2724 0.3157 0.3609 0.4075
b_n= exp(-v./80)./8
b_n = 1×11
0.1250 0.1174 0.1103 0.1036 0.0974 0.0915 0.0859 0.0807 0.0758 0.0712 0.0669

类别

Help CenterFile Exchange 中查找有关 Genomics and Next Generation Sequencing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by