How about this
x = linspace(-10, 10, 1000);
fx = ( x > -0.5 ) & ( x < 0.5 );
figure;
plot( x, fx );
More Related Contents:
- Is there any standard rule for considering the best result or at which stage I have to stop train the data with minimum error
- how to calculate comedian(c) in matlab? [closed]
- Matrix of unknown length in MATLAB?
- MATLAB, Filling in the area between two sets of data, lines in one figure
- Plotting volumetric data in MATLAB
- Octave / Matlab: Extend a vector making it repeat itself?
- How should I update the data of a plot in Matlab?
- Is MATLAB row specific or column major?
- Automatically plot different colored lines
- Get the indices of the n largest elements in a matrix
- How does this code for standardizing data work?
- Matlab: implementing what CTRL+C does, but in the code
- How can I divide each row of a matrix by a fixed row?
- PCA in matlab selecting top n components
- How to subtract a vector from each row of a matrix? [duplicate]
- How can I load 100 files with similar names and/or string in just one step in MATLAB?
- Octave/Matlab: Adding new elements to a vector
- How to use SIFT algorithm to compute how similar two images are?
- using precomputed kernels with libsvm
- Remove noise from wav file, MATLAB
- Convert output from symbolic math (sym) to float
- Solving an ODE when the function is given as discrete values -matlab-
- How to obtain static member variables in MATLAB classes?
- Machine learning – Linear regression using batch gradient descent
- How to nest multiple parfor loops
- Extract arbitrarily rotated plane of data from 3D array as 2D array
- Select largest object in an image
- Efficiently compute a 3D matrix of outer products – MATLAB
- MATLAB Compiler vs MATLAB Coder
- Skipping outputs with anonymous function in MATLAB