comp.soft-sys.matlab
[Top] [All Lists]

Re: Step function

Subject: Re: Step function
From: "Predictor"
Date: 30 Sep 2005 02:55:57 -0700
Newsgroups: comp.soft-sys.matlab
Gigi wrote:
> Hi, I'd like to plot a step function (Ex:y(x)=0 if x<0 and y(x)=1
> if x>=0). Can anybody help me?


Try something like this:

% Generate some abscissa data
X = randn(100,1);

% Calculate step function, using double() to change to double data type
Y = double(X >= 0);

% Display the result
figure, plot(X,Y,'b.'), grid on


-Will Dwinnell
http://will.dwinnell.com


<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy