フィルターのクリア

How to make two signals of same dimensions?

4 ビュー (過去 30 日間)
Muhammad  Abuzar
Muhammad Abuzar 2023 年 1 月 15 日
回答済み: Sufiyan 2023 年 4 月 25 日
I am reading the two audio signals and i want to subtract them both but i face with an error that is that the matrix dimensions must be of the same length?How can i solve this?

回答 (1 件)

Sufiyan
Sufiyan 2023 年 4 月 25 日
Hi,
Here is an example to read the two audio signals and to subtract both.
% read in the two audio signals
[x1, fs1] = audioread('audio1.wav');
[x2, fs2] = audioread('audio2.wav');
% make the signals the same length
min_len = min(length(x1), length(x2));
%or you can use max length audio and add zeros to the other audio to make
%the signals of same length
x1 = x1(1:min_len);
x2 = x2(1:min_len);
% subtract the two signals
y = x1 - x2;
% write the result to a file
audiowrite('output.wav', y, fs1);
Hope this helps!

カテゴリ

Help Center および File ExchangeSignal Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by