Draw curves in matlab
2 次查看(过去 30 天)
显示 更早的评论
I have multiple excel files.From which I want to make curves for theoratical and experimental part. I have written code in which I have made curve by import txt file and this graph contains one theoratical and one experimental curve at T=1500. But now I want to draw multiple theoratical and experimental curves from different excel files or sheets in which value of T will be change for each file. Can anayone help me to write code? I have attached matlab code.
syms x
load Book1.txt;
wave=Book1(:,1);
corr=Book1(:,2);
Efficiency=Book1(:,3);
experiment=Book1(:,4);
theoratical=Book1(:,5);
% Theoratical curve
counts=(experiment/corr);
Photoelectrons=((counts-50)*4)/5;
Photons=((Photoelectrons)*(Efficiency));
Energy =(Photons*(1240/wave));%(nm)
W=(Energy/100);
N=(W/(5.3*10^(-12)));
yyaxis left
plot(wave,N)
hold on
% experimental curve
t=100;
h=6.62e-34;%J*s
c=3e8;%m/s
k=1.38E-23;%J/K
r=26e-6;%beam radius
T=1500;
z=5.67e-8;
f=(((15*z*T)/(3.14^4))*((k*T)/(h*c))*(x^4))*(10^6);
intf=int(f);
yyaxis right
a=fplot(intf,[600 800]);
0 个评论
回答(1 个)
KSSV
2021-5-4
txtfiles = dir('*.txt') ;
N = lewngth(txtfiles) ;
for i = 1:N
load(txtfiles(i).name) ;
wave=Book1(:,1);
corr=Book1(:,2);
Efficiency=Book1(:,3);
experiment=Book1(:,4);
theoratical=Book1(:,5);
figure(i)
% Theoratical curve
counts=(experiment/corr);
Photoelectrons=((counts-50)*4)/5;
Photons=((Photoelectrons)*(Efficiency));
Energy =(Photons*(1240/wave));%(nm)
W=(Energy/100);
N=(W/(5.3*10^(-12)));
yyaxis left
plot(wave,N)
hold on
% experimental curve
t=100;
h=6.62e-34;%J*s
c=3e8;%m/s
k=1.38E-23;%J/K
r=26e-6;%beam radius
T=1500;
z=5.67e-8;
f=(((15*z*T)/(3.14^4))*((k*T)/(h*c))*(x^4))*(10^6);
intf=int(f);
yyaxis right
a=fplot(intf,[600 800]);
end
2 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Large Files and Big Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!