Draw curves in matlab
2 views (last 30 days)
Show older comments
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 Comments
Answers (1)
KSSV
on 4 May 2021
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 Comments
See Also
Categories
Find more on Large Files and Big Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!