How can I do 1D convolution on a 880*1 feature with filter size 45*1 with stride of 42?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a 885*1 feature and I would like to do a convolution with 45*1 with stride 42.
I want to get a 21*1 feature as a result.
If input layer(885*1) is named A, what sholud be the code?
0 commentaires
Réponses (1)
Matt J
le 19 Juil 2020
Modifié(e) : Matt J
le 19 Juil 2020
You can create a weight matrix that computes the convolution using func2mat on the File Exchange
For example,
>> k=rand(45,1);
>> C=func2mat(@(z) conv(z,k,'valid'),rand(885,1));
>> C=C(1:42:end,:);
>> whos C
Name Size Bytes Class Attributes
C 21x885 22208 double sparse
If you wish, you can verify that C*x gives the equivalent convolution as follows,
>> x=rand(885,1);
>> y1=conv(x,k,'valid'); y1=y1(1:42:end);
>> y2=C*x;
>> norm(y1-y2)
ans =
1.2809e-14
0 commentaires
Voir également
Catégories
En savoir plus sur Filter Analysis dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!