resample gives dimension error

F
Farrahakhtar · Feb 19, 2021 · 1.9K views
Question
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 PhD Expert
Answered Aug 23, 2026
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?
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!