create a script that will figure simulink data using stairs in matlab

Assuming you have a vector of data that you want to "staircase":

main.m
data = [0,1,1,2,2,2,3,3,3,3,3,3,3,3,3,2,2,1,1,0];
50 chars
2 lines

We can use the stairs() function to generate a "staircase" plot of the data:

main.m
stairs(data);
14 chars
2 lines

This will generate a plot with diagonal lines connecting successive data points. You can customize the appearance of the plot using the usual plot() options (e.g. linewidth, color, linestyle, etc.).

related categories

gistlibby LogSnag