Info

This question is closed. Reopen it to edit or answer.

how can i put the jreftran function in loop

1 view (last 30 days)
zina shadidi
zina shadidi on 11 Nov 2020
Closed: MATLAB Answer Bot on 20 Aug 2021
Hi to all Mathworks
If I want to change many variables in (jreftran function) like
[r,t,R,T,A]=rerlect_rt(l,[NaN,500,100,NaN],[1,2.9+0i,1.458+0i,1],0,0) %
this function works ,but i need to change l also ,in a loop from 400 to 800
how can I do this please
  1 Comment
zina shadidi
zina shadidi on 11 Nov 2020
I am trying to change the first input variable in the above function by these steps
%% Call the transfer matrix R, T, A calculator function and build spectra
%%%may be need to % Convert angle to radians
[n1]=xlsread('SiO2_n_k.xlsx');
[n2]=xlsread('TiO2_n_k.xlsx');
l= 41;
i=1:l;
n = n1(i,2);
m = n2(i,2);
W1=n2(i,1);
% Preallocate memory
R = zeros(1,l);
T = zeros(1,l);
A = zeros(1,l);
for m = 1:l
% Reflection and transmission coefficients, r, t, not used, so
% replace output with ~. Can add back in if needed.
% [r(m),t(m),R(m),T(m),A(m)]=jreftran_rt(wl(m),d,n(m,:),t0,polarization);
% full form of jreftran_rt
[~,~,R,T,A]=rerlect_rt(l,[NaN,100,500,2000],[1,2.9+0i,1.458+0i,1.5],0,0)
but I have the folowing error
Error: File: rerlect_rt.m Line: 8 Column: 22
Function with duplicate name "rerlect_rt" cannot be defined.
Error in Untitled2 (line 20)
[~,~,R,T,A]=rerlect_rt(l,[NaN,100,500,2000],[1,2.9+0i,1.458+0i,1.5],0,0)

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!