Question
Hi, I have the following code. x1=wavread('speech.wav'); x2=wavread('speech_noise.wav'); I have to do x2-x1 I am getting the error as Dimension mismatch. How to rectify it?
Related Questions
Expert Answer
John Williams
PhD Expert
Answered Nov 20, 2025
Assuming they correspond to the same sampling rates, truncate one of them to be of the same length as the smaller one:
n1 = length(x1); n2 = length(x2); % Assuming n1 < n2 x2 = x2(1:n1)
Or maybe you want to interpolate
x2 = interp1(1:n2, x2, linspace(1, n2, n1));
Have a different question? Ask here