MATLAB Answers

Hamed Amini
1

area, stairs

Asked by Hamed Amini
on 20 Jul 2011

Is there any property setting for 'area' function which generates the 'straits' for the boundary of the colored regions instead of 'plot' curves?

http://www.mathworks.com/help/techdoc/creating_plots/f10-19972.html#f10-1833

  0 Comments

Products

No products are associated with this question.

1 Answer

Answer by Oleg Komarov
on 20 Jul 2011
 Accepted answer

% Random row input

x = 1:10;
y = rand(1,10);

% Normal area chart

subplot(3,1,1)
area(x,y)

% Stairs chart (non area)

subplot(3,1,2)
stairs(x,y)

% Stairs area

subplot(3,1,3)
x = [x;x];
y = [y;y];
area(x([2:end end]),y(1:end))

  1 Comment

Very Clever! Thanks Oleg.


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!