Write a Convolution function without using for loop and verify result using conv function.

5 ビュー (過去 30 日間)
Girish Singh
Girish Singh 2024 年 9 月 15 日
コメント済み: John D'Errico 2024 年 9 月 15 日
Write a Convolution function with two inputs x[n] and h[n] without using for loop and verify result using conv function.

回答 (1 件)

Gojo
Gojo 2024 年 9 月 15 日
Hey Girish,
In order to get weights of convolution function without using the for loop, you can use the "toeplitz" function to construct matrix where each column is a shifted version of the input signal. You can refer to the following documentation: https://www.mathworks.com/help/matlab/ref/toeplitz.html
You can use this function to construct arrays using which you can find the desired weights of convolution by performing matrix multiplication/ dot product.
You may take hints from the implementation of the "conv" function itself by referring to the "More About" section of the following documentation: https://www.mathworks.com/help/matlab/ref/conv.html#:~:text=length(u).-,More%20About,-collapse%20all
I hope this helps!

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by