MATLAB: Running this problem an error occurs: ??? Error using ==> rem Not enough input arguments.

triangular window(dsp)

clear all;
clc;
N=20;
if (rem(N,2)==0)
for n= 1:(N+1)/2
b(n)=(2*n)/N;
end
for n=(N/2)+1:N
b(n)=(2*(N-n+1)/N);
end
else
for n= 1:(N+1)/2;
b(n)=(2*n)/(N+1);
end
for n=(N+1)/2:N
b(n)=(2*(N-n+1)/(N+1));
end
plot(b)
xlabel('time samples')
ylabel('amplitude')
title('triangular window')
end

Best Answer

If you delete the useless "clear all", you can use the debugger for further investigation:
dbstop if error
Then Matlab stops when the error occurs and you can check in detail, what's going on in the current line of code.
clear all deletes all breakpoints and debugging conditions. Therefore it is a really bad idea.
Related Question