forked from SergioBonaqueGonzalez/Shack-Hartmann-Simulator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindice.m
31 lines (25 loc) · 784 Bytes
/
indice.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function [ngra mazi] = indice(jfin)
%Created by Sergio Bonaque-Gonzalez. Optical Engineer.
% This is an auxiliary function for compute Zernike coefficients.
n_gra = zeros(1, jfin + 10);
m_azi = zeros(1, jfin + 10);
% RADIAL DEGREES AND AZIMUTHAL FRENCUENCY ASSOCIATED TO POLYNOMIAL J INDEX.
n = 1;
j = 0.0;
while (j <= jfin)
for mm = 0:n
j = ((n * (n + 1.0)) / 2.0) + mm + 1.0;
if (paridad(n) ~= paridad(mm))
m = mm + 1;
else
m = mm;
end
n_gra(j) = n;
m_azi(j) = m;
end
n = n + 1;
end
ngra = n_gra(jfin);
mazi = m_azi(jfin);
end