Stellar motion using MATLAB
You can examine the star by studying the light came from it
Split light into its wavelength
Measure the intensity absorbed at each wavelength
There is specific minimum wavelength of particular star due to its atomic properties
But minimum wavelength obtained is different,so if there difference is negative then start is moving towards the earth & if it is positive then start is moving away from the earh
#Stellar Motion
load starData
nObs = size(spectra,1)
lambdaStart = 630.02
lambdaDelta = 0.14
#Make the array of wavelength with difference of lambdaDelta
lambdaEnd = lambdaStart + (nObs-1)*lambdaDelta
lambda = (lambdaStart:lambdaDelta:lambdaEnd)
#Get the spectra of HD STAR
s = spectra(:,2)
#plot lambda VS spectra
plot(lambda,s,".-")
xlabel("Wavelength")
ylabel("Intensity")
#Find minimum intensity & its wavelength
[sHa,idx] = min(s)
lambdaHa = lambda(idx)
#Add the plot
X = lambdaHa
Y = sHa
hold on
plot(X,Y,"rs",MarkerSize=8)
hold off
#Calulate red shift factor and speed
z = (lambdaHa/656.28)-1
speed = z*299792.458**