MATLAB: Don’t the stem graph vertical lines appear

graphgraphicslineSimscape Electricalstem

Hello! I'm currently facing a problem using Matlab r2015a. When I draw a stem graph, the lines that are supposed to connect the points and the horizontal axis, do not appear. How can I make them appear? Thank you for your time.

Best Answer

It worked for me. I get vertical lines. Try this, changing the 'LineWidth' property:
x = linspace(-2*pi,2*pi,100);
y = 4*pi*randn(1,100)-2*pi;
figure;
subplot(2,1,1);
plot(x,y,'-r.')
grid on;
subplot(2,1,2);
stem(x,y, 'LineWidth', 3)
grid on;
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Get rid of tool bar and pulldown menus that are along top of figure.
set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Stem Test', 'NumberTitle', 'Off')