pwc_plot_1d


pwc_plot_1d, a MATLAB code which plots piecewise constant (PWC) data.

Suppose you want to plot a piecewise constant function as N bars of varying heights and widths, or as a sequence of step functions. This is NOT quite a bar plot or histogram, and it's not the line graph created by connecting the data points.

The pwc_plot_1d() library assumes that your function is defined as N+1 breakpoints X and N values Y. That is, between X(I) and X(I+1), your function has the value Y(I), for I from 1 to N. The bar plot or line plot should exactly correspond to this idea.

To create the correct bar plot or line graph, the library converts your X and Y data into vectors XP and YP of length 2*N+2 or 3*N+1 which, if simply given to MATLAB's plot() command, will display the corresponding piecewise constant function.

Licensing:

The computer code and data files described and made available on this web page are distributed under the MIT license

Languages:

pwc_plot_1d is available in a MATLAB version.

Related Data and Programs:

box_display, a MATLAB code which displays a box plot, over integer pairs of data, of a function defined by two formulas.

box_plot, a MATLAB code which displays a box plot of data that consists of pairs of integers;

cc_display, a MATLAB code which displays the points used in a 2D Clenshaw-Curtis quadrature rule;

circle_grid_display, a MATLAB code which reads a matrix of integers, and draws a corresponding grid of circles filled with color.

grf_display, a MATLAB code which reads a GRF file defining a mathematical graph and displays it in the MATLAB graphics window.

grid_display, a MATLAB code which reads a file of points on a grid or sparse grid, displays the grid and saves the image in a Portable Network Graphics (PNG) file;

histogram_display, a MATLAB code which makes a bar plot of a set of data stored as columns in a file; the first column is the X values, and all the other columns are Y values to be shown as a stack of bars;

pwc_plot_1d_test

pwc_plot_2d, a MATLAB code which converts the definition of a piecewise constant (PWC) function of a 2D argument into plottable data.

Source Code:


Last revised on 22 April 2021.