image thumbnail

MATLAB Plot Gallery - Stem Plot (2)

by

 

24 Feb 2012 (Updated )

Create stem plot with multiple data

Stem_Plot_2

This is an example of how to create a stem plot with multiple data in MATLAB®.

Read about the stem function in the MATLAB documentation.

For more examples, go to MATLAB Plot Gallery

% Load the filter data
load filterData time signal filter1 filter2

% Create a stem plot using the stem function
figure
stem(time, signal, 'filled')
hold on

% Add the second and third data sets to the plot
stem(time - 0.2, filter1, 'c', 'filled')
stem(time - 0.4, filter2, 'm', 'filled')

% Add a legend
legend('Input Signal', 'Input Delayed by 0.2', ...
    'Input Delayed by 0.4', 'Location', 'SouthWest')

Contact us