build_snd
PURPOSE
function [waveform, T] = build_snd(freqs, amplitudes, phases, Fs, npts)
SYNOPSIS
function [waveform, T] = build_snd(freqs, amplitudes, phases, Fs, npts)
DESCRIPTION
CROSS-REFERENCE INFORMATION
This function calls:
This function is called by:
SOURCE CODE
0001 function [waveform, T] = build_snd(freqs, amplitudes, phases, Fs, npts)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 if max(freqs) > Fs/2
0016 error(['Maximum specified frequency <' int2str(max(freqs)) '> greater than nyquist (' int2str(Fs/2) ')']);
0017 end
0018
0019 freqs = freqs(:)';
0020 amplitudes = amplitudes(:)';
0021 phases = phases(:)';
0022
0023 waveform = ones(npts,1)*amplitudes .* sin(2*pi*((0:npts-1)'/Fs*freqs + ones(npts,1)*phases/360));
0024
0025 T = (0:npts-1)/Fs;
0026
0027 if size(waveform,2) > 1
0028 waveform = sum(waveform,2);
0029 end
0030
0031 return
Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003