import AstroUtil.*
help cosmo.ad_dist
[LC,Period]=AstroUtil.binary.eb_light_curve([100 20],[1 0.6],[0.01 0.01],[0 0.3 0.2 0 0 pi./2],'AstroUtil.binary.limb_darkening');
plot(LC(:,1),LC(:,2),'k-'); invy

AstroUtil.binary.plot_eb_lc_ph([100 20],[1 0.6],[0.01 0.01],[0 0.3 0.2 0 0 pi./2],'AstroUtil.binary.limb_darkening');
t=[0:1:365].';
e=0.3;
a=1;
RAD = 180./pi;
RV=AstroUtil.binary.binary_rv(t,365,0,a./(1-e),e,85./RAD,100);
plot(t,RV)
Time = (1:1:700)';
% define the orbital elements
P    = 365;
T    = 0;
q    = 1;
e    = 0.6;
i    = 1;
omega = 3.9;
Nt = numel(Time);
% generate RV curve
[RV,K2] = AstroUtil.binary.binary_rv(Time,P,T,q,e,i,omega);
RV = RV./1e5;
RV = RV + randn(Nt,1);
% calculate the periogogram
VecP = (100:1:500)';
[Res,FreqVec]=AstroUtil.binary.fit_rv_ellipse(Time,RV,VecP);
% plot the rms vs. the period
plot(VecP,[Res.RMS]','k-');
[x,y,q]=AstroUtil.binary.equipot(1,0.7,0.7.*1e9,3,50);
mesh(x,y,q);
import AstroUtil.cosmo.*
z=(0:0.1:5)';
% calculate angular diameter distance
D=ad_dist(z);
plot(z,D)
% calculate lookback time
T = lookback_time(z);
% plot angular diameter distance as a function of lookback time [s]
plot(T,D)
% calculate angular diameter distance [pc] between z1 and z2
z1=1;
z2=2;
ad_dist([z1 z2])
% note this is not the same as:
ad_dist(z2)-ad_dist(z1)
% The last calculation is incorrect and should not be used!


[Par,ErrPar]=AstroUtil.cosmo.cosmo_pars('planck')
z=(0:0.1:1)';
D=AstroUtil.cosmo.ad_dist(z,'wmap9');
% or you can provide the parameters directly:
H0=100;
OmegaM = 0.3;
OmegaL = 0.7;
D=AstroUtil.cosmo.ad_dist(z,[H0,OmegaM,OmegaL]);

OmegaM=[0:0.01:3]';  % define a vector of Omega matter
[OmL_EF,OmL_NS]=AstroUtil.cosmo.omega_m_lambda_lines(OmegaM);
plot(OmegaM,OmL_EF); hold on; plot(OmegaM,OmL_NS,'r');
xlabel('\Omega_{m}'); ylabel('\Omega_{\Lambda}');
axis([0 3 -1 4.5]);
text(1.5,-0.2,'Expand forever'); text(0.5,3.5,'No singularity');
RAD = 180./pi;
[ER,T1,T2,Mu1,Mu2,TD1,TD2,Tcm]=AstroUtil.microlensing.pointsource_lens(1,5000,10000,5000,1./(1000.*RAD.*3600))
% microlensing parameters
Pars.T0   = 0;  % time of min. impact parameter
Pars.Beta = 0.01;  % impact parameters in units of the Einstein radsius
Pars.V    = 0.1;   % velocity [Einstein rdaius per day]
Pars.Alpha = 1;    % blensing parameter
Pars.BaseMag = 19; % Source base magnitude
Time = (-30:0.1:30).';
[Mag,Res]=AstroUtil.microlensing.microlens_ps(Pars,Time);
plot(Res.T,Mag); invy;
% or similarly with finate source effect
Pars.FS = 0.1;  % source size in units of the Einstein radius
[Mag,Res]=AstroUtil.microlensing.microlens_psfs(Pars,Time);
plot(Res.T,Mag); invy;
Dist = (0:0.01:20)';
[I_rho,A_rho]=AstroUtil.Occultation.fresnel_occultation_ps(0.9,Dist);
plot(Dist,I_rho)
[C,E]=AstroUtil.stars.star_sptype_color('A3','IV','SDSS','g','AB','SDSS','r','AB')
[Ev,UBV]=AstroUtil.stars.stellar_tracks(1,0.04,'c');
Time = (1:1:100)';
[E,E_Ni,E_Co]=AstroUtil.supernova.nickel56_decay(Time);
loglog(Time,E)
Undefined variable "AstroUtil" or class "AstroUtil.mlx".