Borrar filtros
Borrar filtros

Performing convolution - 3 signals are convolving with three corresponding signal ?

17 visualizaciones (últimos 30 días)
Ahmed
Ahmed el 23 de Jun. de 2024 a las 9:50
Respondida: Image Analyst el 23 de Jun. de 2024 a las 20:23
I have attached the data and facing a following problem.
In a first step I am convolving a wav (101 x 1) with trc (101 x 3) e.g., a single wav is being convolved three trc vectors (of equal number of rows) and giving three outputs. I am using following code and it is working:
synth = conv2(wav_near', trc);
t0_i = floor(t0/dt); Nl = 101;
synth = synth(1+t0_i:Nl+t0_i,:);
Now, I have three wav (108 3) and want to convolve with trc (120 3) in way like the first wav will convolve with first trc, second wav with second trc and so on. I have attached all the three wav (wav_near, wav_mid, wav_far) and trc. I tried a lot of combinations but they are not working. How can I change the above code in this case?
The size of outcomes should be the size of trc.
One way I tried like but results are not same
synth = zeros(120, 3);
% Loop through each column
for col = 1:3
conv_result = conv2(wav(:, col), trc(:, col), 'full')
start_idx = floor((length(wav(:, col)) - 1) / 2) + 1;
end_idx = start_idx + 120 - 1;
synth(:, col) = conv_result(start_idx:end_idx);
end

Respuestas (2)

Ahmed
Ahmed el 23 de Jun. de 2024 a las 10:11
I find a way to do it and it is working.
synth = zeros(Nl, 3);
% Loop through each column
for col = 1:3
conv_result = conv2(wav(:, col), trc(:, col));
synth(:, col) = conv_result(1 + t0_i:Nl + t0_i);
end

Image Analyst
Image Analyst el 23 de Jun. de 2024 a las 20:23
The result of a normal, full convolution is the sum of the extents of the two waveforms. You can automatically crop to the length of the first argument (vector) if you use the 'same' option. This is usually used when the first vector is a long signal, and the second vector is a short vector that is the filter window.

Categorías

Más información sobre Audio Processing Algorithm Design en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by