stftLayer
Short-time Fourier transform layer
Description
An STFT layer computes the short-time Fourier transform of the input.Use of this layer requires Deep Learning Toolbox™.
创建GydF4y2Ba
Description
creates aShort-Time Fourier Transform((STFT) layer. The input tolayer
=stftLayerstftLayer
must be adlarray
(深度学习工具箱)GydF4y2Ba对象中GydF4y2Ba"CBT"
Format with a size along the time dimension greater than the length of窗户GydF4y2Ba
。GydF4y2Ba
specifies optional parameters using name-value arguments. You can specify the analysis window and the format of the output, among others.layer
=stftLayer(名称=值GydF4y2Ba
)GydF4y2Ba
Properties
STFT
窗户GydF4y2Ba
-GydF4y2Ba分析窗口GydF4y2Ba
汉恩GydF4y2Ba
((128,'periodic')
(默认)|GydF4y2Ba向量GydF4y2Ba
汉恩GydF4y2Ba
((128,'periodic')This property is read-only.
分析窗口用于计算STFT,该窗口指定为具有两个或两个元素的向量。GydF4y2Ba
Example:(1-COS(2*PI*(0:127)'/127))/2GydF4y2Ba
and
both specify a Hann window of length 128.汉恩GydF4y2Ba
(128)GydF4y2Ba
Data Types:double
|GydF4y2Ba单身的GydF4y2Ba
OverlapLength
-GydF4y2Banumber of overlapped samples
96
(默认)|GydF4y2Ba正整数GydF4y2Ba
This property is read-only.
number of overlapped samples, specified as a positive integer strictly smaller than the length of窗户GydF4y2Ba
。GydF4y2Ba
The stride between consecutive windows is the difference between the window length and the number of overlapped samples.
Data Types:double
|GydF4y2Ba单身的GydF4y2Ba
FFTLength
-GydF4y2Banumber of DFT points
128GydF4y2Ba
(默认)|GydF4y2Ba正整数GydF4y2Ba
This property is read-only.
number of frequency points used to compute the discrete Fourier transform, specified as a positive integer greater than or equal to the window length. If not specified, this argument defaults to the length of the window.
If the length of the input data along the time dimension is less than the number of DFT points,stftLayer
right-pads the data and the window with zeros so they have a length equal toFFTLength
。GydF4y2Ba
Data Types:double
|GydF4y2Ba单身的GydF4y2Ba
转换模式GydF4y2Ba
-GydF4y2Ba层变换模式GydF4y2Ba
“ mag”GydF4y2Ba
(默认)|GydF4y2Ba“ Squaremag”GydF4y2Ba
|GydF4y2Ba“ logmag”GydF4y2Ba
|GydF4y2Ba“ logsquaremag”GydF4y2Ba
|GydF4y2Ba"realimag"
图层变换模式,指定为以下之一:GydF4y2Ba
“ mag”GydF4y2Ba
- stft幅度GydF4y2Ba“ Squaremag”GydF4y2Ba
-STFT squared magnitude“ logmag”GydF4y2Ba
- stft幅度的自然对数GydF4y2Ba“ logsquaremag”GydF4y2Ba
- stft平方幅度的自然对数GydF4y2Ba"realimag"
-real and imaginary parts of the STFT, concatenated along the channel dimension
Data Types:char
|GydF4y2Ba细绳GydF4y2Ba
OutputModeGydF4y2Ba
-GydF4y2Balayer output mode
"spatiotemporal"
(默认)|GydF4y2Ba"spatial"
|GydF4y2Ba"temporal"
layer output mode, specified as one of these:
"spatiotemporal"
- 将输出格式为1-D图像的序列,其中图像高度对应于频率,第二维对应于通道,第三维对应于批处理,第四维对应于时间。GydF4y2Ba您可以使用此输出模式来馈送输出GydF4y2Ba
stftLayer
to a 1-D convolutional layer when you want to convolve along frequency. For more information, seeconvolution1dLayer
(深度学习工具箱)GydF4y2Ba。GydF4y2Ba"spatial"
- 将输出格式化为2-D图像的序列,其中图像高度对应于频率,图像宽度对应于时间。第三和第四维分别对应于通道和批次。GydF4y2Ba您可以使用此输出模式来馈送输出GydF4y2Ba
stftLayer
to a 2-D convolutional layer when you want to convolve along the two spatial dimensions. For more information, seeconvolution2dLayer
(深度学习工具箱)GydF4y2Ba。GydF4y2Ba"temporal"
- 将输出格式化为1-D序列。这种格式采用GydF4y2Ba"spatiotemporal"
输出格式并将图像高度拉成通道尺寸。STFT输出的第二维对应于批处理,第三维对应于时间。GydF4y2Ba您可以使用此输出模式来馈送输出GydF4y2Ba
stftLayer
当您想随着时间的推移进行卷积时,到1D卷积层。有关更多信息,请参阅GydF4y2Baconvolution1dLayer
(深度学习工具箱)GydF4y2Ba。You can also use this output mode to usestftLayer
作为复发性神经网络的一部分。有关更多信息,请参阅GydF4y2BalstmLayer
(深度学习工具箱)GydF4y2BaandGrulayerGydF4y2Ba
(深度学习工具箱)GydF4y2Ba。GydF4y2Ba
Data Types:char
|GydF4y2Ba细绳GydF4y2Ba
layer
重量应培训GydF4y2Ba
-GydF4y2Bamultiplier for weight learning rate
0GydF4y2Ba
(默认)|GydF4y2Banonnegative scalar
multiplier for weight learning rate, specified as a nonnegative scalar. If not specified, this property defaults to zero, resulting in weights that do not update with training. You can also set this property using thesetLearnrateFactorGydF4y2Ba
(深度学习工具箱)GydF4y2BaFunction.
Data Types:double
|GydF4y2Ba单身的GydF4y2Ba
姓名GydF4y2Ba
-GydF4y2Ba图层名称GydF4y2Ba
''
(默认)|GydF4y2Bacharacter vector|GydF4y2Ba字符串标量GydF4y2Ba
图层名称,,,,specified as a character vector or a string scalar. Forlayer
数组输入,GydF4y2BatrainNetwork
,,,,GydF4y2BaassembleNetwork
,,,,GydF4y2BalayerGraph
,,,,anddlnetwork
Functions automatically assign names to layers with name''
。GydF4y2Ba
Data Types:char
|GydF4y2Ba细绳GydF4y2Ba
numInputs
-GydF4y2Banumber of inputs
1GydF4y2Ba
((default)
This property is read-only.
number of inputs of the layer. This layer accepts a single input only.
Data Types:double
InputNames
-GydF4y2Ba输入名称GydF4y2Ba
{'在'}GydF4y2Ba
((default)
This property is read-only.
输入名称of the layer. This layer accepts a single input only.
Data Types:cell
numOutputsGydF4y2Ba
-GydF4y2Ba输出数量GydF4y2Ba
1GydF4y2Ba
((default)
This property is read-only.
输出数量of the layer. This layer has a single output only.
Data Types:double
OutputNames
-GydF4y2BaOutput names
{'出去'}GydF4y2Ba
((default)
This property is read-only.
Output names of the layer. This layer has a single output only.
Data Types:cell
Examples
Short-Time Fourier Transform of Chirp
生成以600 Hz采样的信号2秒。该信号由正弦变化频率含量的呼叫组成。将信号存储在深度学习阵列中GydF4y2Ba“ CTB”GydF4y2Ba
格式。GydF4y2Ba
Fs = 6e2; x = vco(sin(2*pi*(0:1/fs:2)),[0.1 0.4]*fs,fs); dlx = dlarray(x,“ CTB”GydF4y2Ba);
创建具有默认属性的短时傅立叶变换层。创建一个GydF4y2Badlnetwork
由序列输入层和短时傅立叶变换层组成的对象。指定最小序列长度为128个样本。通过信号穿过GydF4y2Bapredict
method of the network.
Ftl = stftLayer; dlnet = dlnetwork([sequenceInputLayer(1,MinLength=128) ftl]); netout = predict(dlnet,dlx);
Convert the network output to a numeric array. Use the挤GydF4y2Ba
Function to remove the length-1 channel and batch dimensions. Plot the magnitude of the STFT. The first dimension of the array corresponds to frequency and the second to time.
q = extractdata(netout); waterfall(squeeze(q)') set(gca,XDir="reverse",,,,View=[30 45]) xlabel("Frequency")ylabel("Time")GydF4y2Ba
Short-Time Fourier Transform of Sinusoid
Generate a 3 × 160 (× 1) array containing one batch of a three-channel, 160-sample sinusoidal signal. The normalized sinusoid frequencies areπ/4 rad/样品,GydF4y2Baπ/2 rad/样品,3GydF4y2Baπ/4 rad/sample. Save the signal as adlarray
,,,,specifying the dimensions in order.dlarray
permutes the array dimensions to the"CBT"
深度学习网络期望的形状。GydF4y2Ba
nch = 3; N = 160; x = dlarray(cos(pi.*(1:nch)'/4*(0:N-1)),“ CTB”GydF4y2Ba);
创建一个短时傅里叶变换层,can be used with the sinusoid. Specify a 64-sample rectangular window, 48 samples of overlap between adjoining windows, and 1024 DFT points. Specify the layer output mode as"spatial"
。默认情况下,该层输出STFT的大小。GydF4y2Ba
stfl = stftLayer(Window=rectwin(64),...GydF4y2BaOverlapLength=48,...GydF4y2BaFFTLength=1024,...GydF4y2BaOutputMode=GydF4y2Ba"spatial");
创建一个两层GydF4y2Badlnetwork
object containing a sequence input layer and the STFT layer you just created. Treat each channel of the sinusoid as a feature. Specify the signal length as the minimum sequence length for the input layer.
layers = [sequenceInputlayer(NCH,minLength = n)stfl];dlnet = dlnetwork(层);GydF4y2Ba
正弦GydF4y2BaForward
method of the network.
dataout = forward(dlnet,x);
Convert the network output to a numeric array. Use the挤GydF4y2Ba
功能折叠尺寸批次尺寸。瀑布图中的每个通道分别绘制STFT幅度。GydF4y2Ba
q = squeeze(extractdata(dataout));ForKJ = 1:NCH子图(NCH,1,KJ)瀑布(q(:,::,kj)')视图(30,45)Zlabel(GydF4y2Ba"Ch. "+string(kj))end
更多关于GydF4y2Ba
Short-Time Fourier Transform
短时傅里叶变换)analyze how the frequency content of a nonstationary signal changes over time.
The STFT of a signal is calculated by sliding an分析窗口GydF4y2Baof length 在信号上并计算窗口数据的离散傅立叶变换。窗户以每隔时间间隔在原始信号上GydF4y2Ba samples. Most window functions taper off at the edges to avoid spectral ringing. If a nonzero overlap length 指定,重叠窗口段可补偿窗口边缘处的信号衰减。每个窗口段的DFT添加到一个矩阵中,该矩阵包含每个时间点和频率的幅度和相位。STFT矩阵中的列数由GydF4y2Ba
在哪里GydF4y2Ba 是原始信号的长度GydF4y2Ba 和GydF4y2Ba⌊⌋符号表示地板功能。矩阵中的行数等于GydF4y2BanGydF4y2BaDFTGydF4y2Ba,,,,the number of DFT points, for centered and two-sided transforms and⌊nGydF4y2BaDFTGydF4y2Ba/2⌋ + 1For one-sided transforms.
STFT矩阵由GydF4y2Ba such that the th element of this matrix is
在哪里GydF4y2Ba
- 长度的窗口函数GydF4y2Ba 。GydF4y2Ba
-DFTof windowed data centered about time 。GydF4y2Ba
- 连续DFT之间的跳跃大小。跳尺寸是窗口长度之间的区别GydF4y2Ba 和overlap length 。GydF4y2Ba
The magnitude squared of the STFT yields the频谱图GydF4y2Ba
功能频谱密度的表示。GydF4y2Ba
版本历史记录GydF4y2Ba
也可以看看GydF4y2Ba
应用GydF4y2Ba
- Deep Network Designer(深度学习工具箱)GydF4y2Ba
对象GydF4y2Ba
功能GydF4y2Ba
dlstft
|GydF4y2Bastft
|GydF4y2Baistft
|GydF4y2Bastftmag2sig
Topics
- 深度学习层的清单GydF4y2Ba(深度学习工具箱)GydF4y2Ba
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
mATLAB Command
You clicked a link that corresponds to this MATLAB command:
run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
选择一个网站以获取可用的翻译内容,并查看本地事件和优惠。根据您的位置,我们建议您选择:GydF4y2Ba。GydF4y2Ba
You can also select a web site from the following list:
如何获得最佳网站性能GydF4y2Ba
选择中国网站(中文或英语)以获得最佳场地性能。其他Mathworks乡村网站未针对您所在的访问进行优化。GydF4y2Ba
Americas
- América Latina((Español)
- Canada((English)
- United States((English)
Europe
- Belgium((English)
- Denmark((English)
- 德国GydF4y2Ba((Deutsch)
- España((Español)
- 芬兰GydF4y2Ba((English)
- France(Français)GydF4y2Ba
- Ireland((English)
- Italia((Italiano)
- 卢森堡GydF4y2Ba((English)
- netherlands((English)
- norway((English)
- ÖsterreichGydF4y2Ba((Deutsch)
- Portugal((English)
- 瑞典GydF4y2Ba((English)
- Switzerland
- United Kingdom((English)
Asia Pacific
- 澳大利亚GydF4y2Ba((English)
- India((English)
- new Zealand((English)
- 中国GydF4y2Ba
- 日本((日本語)
- 한국((한국어)