function [K]=ray_kernel(r_path,t_phase,R,r,w,cs,wcs); % MATLAB HELP: % % function [K]=ray_kernel(r_path,t_phase,R,r,w,cs,wcs); % % inputs: % r_path, radius along the ray % t_phase, phase time along the ray % R, solar radius % r, radius grid % w, frequency of the ray % cs, square of the sound speed % wcs, square of the acoustic cutoff frequency % % output: % K, travel-time kernel for the square of the sound speed % % see ray_codes.ps for more details % % aaron birch may 22 2002 % % square of the sound speed along the path % c_path=interp1(r,sqrt(cs),r_path); % % have to be careful about the twos here, % we want a kernel for the perturbation to the % the travel time by pert. to SQUARE of sound speed % K=-R*(1+wcs./(w^2-wcs)).*interp1(r_path,gradient(t_phase,r_path),r); % % put zeros below the lower turning point % I=find(isnan(K));K(I)=zeros(size(I));