Hi Colin
1.
is there need for the for loop?
i = -3:.5:2;
k = 10.^i;
n = (100 ./ k);
s = sqrt((-.5^2 .* ((100 ./ k)-(.5.*(100 ./ k)))./(100-(100 ./ k)))./((((100 ./ k)-(.5.*(100 ./ k)))./(100-(100 ./ k)))-1));
2.
NaNs to 1
3.
abs(s)>1 to 1, instead of
get the indices of s meeting constrain abs(s)>1 with command find
4.
if you want the previous 2 constraints combined then, instead of
use
intersect(find(s(abs(s)>1), find(isnan(abs(s)))
5. instead of
use
6.
instead of
if (s>0) && (s<=1)
s = s;
use
intersect( s(abs(s)>0), s(abs(s)<=1))
but wouldn't it be just fine to leave these remaining as they are?
7.
the last
would zero useful data, omitted
so all together
i = -3:.5:2;
k = 10.^i;
n = (100 ./ k);
s = sqrt((-.5^2 .* ((100 ./ k)-(.5.*(100 ./ k)))./(100-(100 ./ k)))./((((100 ./ k)-(.5.*(100 ./ k)))./(100-(100 ./ k)))-1));
s(find(isnan(s)))=1
s(find(s(abs(s)>1)))=1
s(find(imag(s)==0))=0
.
for the generation of RT do you want to use
or
RTIlogk= [i' k' n' abs(s)']
RTIlogk =
1.0e+05 *
Columns 1 through 3
-0.000030000000000 0.000000010000000 1.000000000000000
-0.000025000000000 0.000000031622777 0.316227766016838
-0.000020000000000 0.000000100000000 0.100000000000000
-0.000015000000000 0.000000316227766 0.031622776601684
-0.000010000000000 0.000001000000000 0.010000000000000
-0.000005000000000 0.000003162277660 0.003162277660168
0 0.000010000000000 0.001000000000000
0.000005000000000 0.000031622776602 0.000316227766017
0.000010000000000 0.000100000000000 0.000100000000000
0.000015000000000 0.000316227766017 0.000031622776602
0.000020000000000 0.001000000000000 0.000010000000000
Column 4
0.000002887714078
0.000002889799069
0.000002896422232
0.000002917670114
0.000002988071523
0.000003249532852
0
0
0
0
0
if you find this answer useful would you please be so kind to consider marking my answer as Accepted Answer?
To any other reader, if you find this answer useful please consider clicking on the thumbs-up vote link
thanks in advance for time and attention
John BG
Best Answer