How to plot impulse response?

2 ビュー (過去 30 日間)
dovis838
dovis838 2020 年 3 月 31 日
回答済み: Mehmed Saad 2020 年 3 月 31 日
Hey everyone,
I created signal
[y, fs] = audioread('Voice1.wav');
t=(0:length(y)-1)/fs;
here is the form that impulse response should containt. But instead of [0...0] there shoud be 1x1350 array of zeros and instead of [1...1] should be 1x1350 array of ones.
I need to use convolution to get this form (function conv)
As for now I have managed to write this script:
A = zeros(1,1350); % made 1x1350 array from zeros
B = ones(1,1350); % made 1x1350 array from ones
h=[A B A]; % replaced values from formula
X=conv(y,h); % used this command to make convolution
and now I need to plot this changed function.
[y, fs] = audioread('Voice1.wav');
t=(0:length(y)-1)/fs;
A = zeros(1,1350);
B = ones(1,1350);
h=[A B A];
X=conv(y,h);
plot(t,X)
But when plotting I get error Vectors must be the same length
So the question would be, how to properly write script to plot this function?
P.S. Sorry if the task isn't clear, its hard for me to explain :D

採用された回答

Mehmed Saad
Mehmed Saad 2020 年 3 月 31 日
X=conv(y,h,'same');

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by