function [v, t] = tonec(f,int,fs) % This function will create a series of samples at sampling rate % FS for a duration of INT seconds at frequencies in the first column % of vector F in Hertz. The second column of F will be the weight for % each tone. If a second column is not given then an equal scaling % will be given to each tone. % % [v, t] = tonec(f,int,fs) % % The output is a row vector V containing the sampled points % T is an optional output and is the time axis assoicated with V. % % Written by Kevin D. Donohue (donohue@engr.uky.edu) 6/2003 [r, c] = size(f); % Check dimension of f % Ensure frequency values are in different rows if c > 2 % if not transpose f = f'; [r, c] = size(f); end % Check to see if coefficients for frequenies are provided if c == 1 % If not set them = to one f(:,2) = ones(length(f),1); end t = [0:fix(fs*int)-1]/fs; % Create time axis v = zeros(size(t)); % initialize vector to accumulate multiple tones for k=1:r v = v + f(k,2)*sin(2*pi*t*f(k,1)); % Create sampled tone signal end