📄 genfreqaxis.m
字号:
function [freqAxis, freqLow, freqHigh] = genfreqaxis(carrierFreq, bandwidth, noFreq)%GENFREQAXIS Generates values for a frequency axis.%%--------%Synopsis:% freqAxis = genfreqaxis(carrierFreq, bandwidth, noFreq)% freqAxis = genfreqaxis(carrierFreq, {freqLowOffset, freqHighOffset},noFreq)%% [freqAxis, freqLow, freqHigh] = genfreqaxis(carrierFreq, bandwidth, noFreq)% [freqAxis, freqLow, freqHigh] = genfreqaxis(carrierFreq,% {freqLowOffset, freqHighOffset}, noFreq)%%Description:% Generates a vector with values for a frequency axis which can be used% for example to when plotting a frequency spectrum created by "fft".%%Output and Input:% freqAxis (RealVectorT): The generated vector with frequency values [Hz].% freqLow (RealScalarT): The lowest frequency in the bandwidth [Hz].% freqHigh (RealScalarT): The highest frequency in the bandwidth [Hz]. % Note that this is not equal to the highest value in the vector% "freqAxis".% carrierFreq (RealScalarT): Carrier frequency [Hz]. This can be specified to% zero for baseband signals.% bandwidth (RealScalarT): Bandwidth [Hz].% freqLowOffset (RealScalarT): Relative low frequency limit [Hz].% freqHighOffset (RealScalarT): Relative high frequency limit [Hz].% noFreq (IntScalarT): Number of frequency values to generate.%%--------%Notations:% Data type names are shown in parentheses and they start with a capital% letter and end with a capital T. Data type definitions can be found in [1]% or by "help dbtdata".% [D] = This parameter can be omitted and then a default value is used.% When the [D]-input parameter is not the last used in the call, it must be% given the value [], i.e. an empty matrix.% ... = There can be more parameters. They are explained under respective% metod or choice.%%Examples:% noSamples = 64;% endTime = 10;% sampleTime = endTime /(noSamples-1)% samplefreq = 1/sampleTime% bandwith = samplefreq/2; % A real valued time signal.% t = linspace(0,endTime,noSamples);% s = sin(2*pi*t);% plot(s), figure% plot(genfreqaxis(0,samplefreq,noSamples).',abs(fftshift(fft(s))))% plotxline([-samplefreq/2, samplefreq/2],'m','--')%%Software Quality:% (About what is done to ascertain software quality. What tests are done.)%%Known Bugs:%%References:% [1]: Bj鰎klund S.: "DBT, A MATLAB Toolbox for Radar Signal Processing.% Reference Guide", FOA-D--9x-00xxx-408--SE, To be published.%%See Also:% * DBT, A Matlab Toolbox for Radar Signal Processing *% (c) FOA 1994-2000. See the file dbtright.m for copyright notice.%% Start : 990208 Svante Bj鰎klund (svabj).% Latest change: $Date: 2000/10/16 15:40:15 $ $Author: svabj $.% $Revision: 1.6 $% *****************************************************************************chkdtype(carrierFreq, 'RealScalarT')chkdtype(bandwidth, 'RealScalarT', 'CellArrayT')chkdtype(noFreq, 'IntScalarT')if (iscell(bandwidth)) freqLow = carrierFreq + bandwidth{1}; freqHigh = carrierFreq + bandwidth{2};else freqLow = carrierFreq - bandwidth/2; freqHigh = carrierFreq + bandwidth/2;end%iffreqAxis = linspace(freqLow, freqHigh, noFreq+1);freqAxis = freqAxis(1:noFreq).';%freqAxis.', freqLow, freqHigh % For debugging.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -