Plot with intervals for x axis

조회 수: 2 (최근 30일)
Nethravathi S
Nethravathi S 2020년 6월 20일
답변: Tommy 2020년 6월 20일
Hello,
I am plotting a graph with the following code:
x=1:1:24
P1=plot(x,poweachslot,'displayname','Load curve without DSM' );
hold on
P2=plot(x,poweachslot1,'displayname','Load curve with DSM' );
xlabel('timeframe')
ylabel('power consumed')
title('Daily load curve')
legend
hold off
This gives me a graph which is like joining the dots for each x value( not able to insert the graph)
How do I get a graph where from x=1-2, y=const1, x=2-3 y=const2 etc..

답변 (1개)

Tommy
Tommy 2020년 6월 20일
I believe stairs() is what you want:

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by