resample gives dimension error

Illustration
Farrahakhtar - 2021-02-19T10:46:53+00:00
Question: resample gives dimension error

When I use the resample function, I get a dimension error. Here is the example used in the MATLAB help file, with the output: fs1 = 10; % Original sampling frequency in Hz t1 = 0:1/fs1:1; % Time vector x = t1; % Define a linear sequence y = resample(x,3,2); % Now resample it Error using +  Matrix dimensions must agree. Error in firls (line 161) b = b + (F(s+1)*(m*F(s+1)+b1)*sinc(2*k*F(s+1)) ... Error in resample (line 85) h = p*firls( L-1, [0 2*fc 2*fc 1], [1 1 0 0]).*kaiser(L,bta)' ;  

Expert Answer

Profile picture of John Williams John Williams answered . 2025-11-20

I'm not sure if you have a non-MathWorks' (modified) version of firls(), but the code you entered above should work:
 
 
fs1 = 10; 
 t1 = 0:1/fs1:1; % Time vector
 x = t1; % Define a linear sequence
 y = resample(x,3,2); % Now resample it
Can you clear you workspace and copy and paste the above?
 
If you enter
>>which firls
Do you get something back like:
 
matlab\toolbox\signal\signal\firls.m
 
Also, which version of MATLAB are you using?


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!