일다 이런 놈들의 식을 써서 프로그램을 만들려고 하는데, 기존 상용툴로,
http://www.filmetrics.com/reflectance-calculator 이런 친구가 있습니당....
그래서 제가 여태까지 짜본 코딩은
wl = 350*10^(-9):10^(-9):850*10^(-9);
ns = 1.5;
n0 = 1;
R = [0];
R_result=[1 1; 1 1];
M_result=[1 1; 1 1];
S_result=[1 1; 1 1];
M_last = [1 1; 1 1];
p = input('How many layers do you want? ');
for k=1:p
n(1,k) = input('Enter refractive coefficient of layer');
l(1,k) = input('Enter length of layer');
for ws = 1:501
A(k,ws) = cos((2*pi)*l(1,k))/wl(1,ws);
B(k,ws) = (-i*sin((2*pi)*l(1,k))/wl(1,ws))/n(1,k);
C(k,ws) = -i*n(1,k)*sin((2*pi)*l(1,k))/wl(1,ws);
D(k,ws) = cos((2*pi)*l(1,k))/wl(1,ws);
end
end
%this is attemt to make.....
for wl_1 = 1:501
for p_1 = 1:p
M_result(:,:,p_1) = [A(p_1,wl_1) B(p_1,wl_1) ; C(p_1,wl_1) D(p_1,wl_1)];
M_last(:,:,wl_1) = M_last(:,:,wl_1) * M_result(:,:,p_1);
end
S(:,:,wl_1) = M_last(:,:,wl_1);
end
왜 행렬의 차원이 일치하지 않는건가요...