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

조회 수: 4 (최근 30일)
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

채택된 답변

Jan
Jan 2013년 8월 4일
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.

추가 답변 (2개)

Chandrasekhar
Chandrasekhar 2013년 8월 3일
there are syntax errors in the code. there is no end for the if else statement and no end for the second for loop
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;
end
end
  댓글 수: 1
palak
palak 2013년 8월 4일
편집: palak 2013년 8월 4일
It had properly been ended by me with one more end statement in the complete program as you said . still it is not working.

댓글을 달려면 로그인하십시오.


Azzi Abdelmalek
Azzi Abdelmalek 2013년 8월 3일
편집: Azzi Abdelmalek 2013년 8월 3일
Type and show the result
which rem
Or check in your current folder if there is a function named rem
  댓글 수: 3
palak
palak 2013년 8월 4일
this is a predefined function not the user defined
Jan
Jan 2013년 8월 4일
@palak: Please post the complete message. Most of all the failing line is important.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by