Info
この質問は閉じられています。 編集または回答するには再度開いてください。
is for loop eating my data :)
    1 回表示 (過去 30 日間)
  
       古いコメントを表示
    
 In the folowing code,  the plot is empty .I think that my data is overlapping.
why i have an  empty plot , and how can i fix it
dbstop if error
h= 6.626*10^-34  ; % joul.second
[n1]=xlsread('Transmittance-calcs.xlsx');
[n2]=xlsread('Reflectance-calcs.(2).xlsx');
L= 11;    % number of rows in excl file
d=900*10^-9; %%total  thickness m
for i=1:L;
 h= 4.135667*10^-34  ;
A(i) = n1(i,2) ;%%%%% second row which Transmittance
B(i) = n2(i,2) ; %%%%% second row which reflectance
 C=(100*A(i));
 Q=1./C;
a=(log(Q)/d);
end
for l=200:50:700;
    v=(3*10^8)/(l*10^-9);
     hv=(h*v)*(6.242*10^18)
ahv2=((a*h*v)*(6.242*10^18)/(100)).^2 %%%% change units from joul/m to ev/cm
end
%plot results:
figure
hold on
plot(hv,ahv2,'b')
0 件のコメント
回答 (1 件)
  James Tursa
      
      
 2020 年 11 月 12 日
        You need to store your calculations at each iteration in a vector. E.g.,
k = 0;
for l=200:50:700;
    k = k + 1;
    v=(3*10^8)/(l*10^-9);
    hv(k)=(h*v)*(6.242*10^18)
    ahv2(k)=((a*h*v)*(6.242*10^18)/(100)).^2 %%%% change units from joul/m to ev/cm
end
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!