How do I apply a function to every resulting element of a buffer function?

2 views (last 30 days)
I've split the sound signal into frames of 256 length using buffer function.
Now I have 256x544 "frames" variable with 256 rows and 544 columns inside when I see it through "Open Selection".
How do I apply a function, e.g. hamming(256), to each column?

Accepted Answer

Star Strider
Star Strider on 3 Oct 2022
How do I apply a function, e.g. hamming(256), to each column?
Do an element-wise multiplication —
v = randn(256,2)
v = 256×2
1.2764 -0.1904 0.9324 0.2411 -1.0898 -0.4778 -1.3075 2.2502 -1.5342 1.5244 0.2590 -0.9400 -0.1452 -0.8611 0.5434 0.7781 -0.0220 1.0027 -0.2428 -2.5638
vh = v.*hamming(256)
vh = 256×2
0.1021 -0.0152 0.0747 0.0193 -0.0878 -0.0385 -0.1062 0.1828 -0.1262 0.1254 0.0216 -0.0785 -0.0123 -0.0732 0.0472 0.0676 -0.0020 0.0891 -0.0222 -0.2340
.

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!