image thumbnail

MATLAB Plot Gallery - Stem Plot (2)

by

 

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.

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