Signum.m
上传用户:loeagle
上传日期:2013-03-02
资源大小:1236k
文件大小:0k
- function y=signum(x)
- %SIGNUM finds the signum of a vector.
- % Y=SIGNUM(X)
- % X=input vector
- y=x;
- y(find(x>0))=ones(size(find(x>0)));
- y(find(x<0))=-ones(size(find(x<0)));
- y(find(x==0))=zeros(size(find(x==0)));