% Routine to generate artificial spectra of binary stars. % % Syntax: sp = bgen(x) % % X is an input wavelength spectrum. % % D. Holmgren, Mar 6 94. holmgren@phobos.astro.uwo.ca function sp = bgen(x) % Enter parameters for both components... a1 = input('Primary depth '); x1 = input('Primary RV '); w1 = input('Primary width '); a2 = input('Secondary depth '); x2 = input('Secondary RV '); w2 = input('Secondary width '); % use random noise to simulate observations... snr = input('Signal-to-noise ratio '); nl = length(x); sp = zeros(nl,1); rand('normal'); n = rand(nl,1) ./ snr; % assume gaussian line profiles... s1 = 2*w1*w1; s2 = 2*w2*w2; sp = 1 - ( a1 .* exp(-((x-x1).^2)./s1) + a2 .* exp(-((x-x2).^2)./s2)); sp = sp + n; plot(x,sp)