Matlab计算最大红移Zmax

函数文件 1 zvr1.m

function rv1=zv1(H)
global H
rv1=1/0.003335641/H
______________________________________________________________________

函数文件 2 zerw.m

function ze=zerw(r,M,a,V0)
global M a V0
k1=0.005296998;
k2=0.240582497;
k3=0.360873745;
ze=(k1*V0*M*r*r+k2/r-k3*M/a)/(1-k1*V0*M*r*r-k2/r)
______________________________________________________________________

函数文件 3 zmax.m

function zmax=zmax(r,H,M,a,V0)
global H M a V0
zmax=1.5+zerw(r)
______________________________________________________________________

M文件:  maxz.m

global H M a V0
H=input('H=');
M=input('M=');
a=input('a=');
V0=input('V0=');
zv1
r=input('r=');
zmax(r)