Main Content

계단 플롯과 선 플롯 겹치기

이 예제에서는 계단 플롯에 선 플롯을 겹치는 방법을 보여줍니다.

플로팅할 데이터를 정의합니다.

alpha = 0.01;
beta = 0.5;
t = 0:10;
f = exp(-alpha*t).*sin(beta*t);

f를 계단 플롯으로 표시합니다. hold 함수를 사용하여 계단 플롯을 유지합니다. 별 마커와 함께 파선을 사용하여 f에 대한 선 플롯을 추가합니다.

stairs(t,f)
hold on 
plot(t,f,'--*')
hold off

Figure contains an axes object. The axes object contains 2 objects of type stair, line.

axis 함수를 사용하여 축 제한을 설정합니다. x축에 레이블을 지정하고 제목을 그래프에 추가합니다.

axis([0,10,-1.2,1.2])
xlabel('t = 0:10')
title('Stairstep plot of e^{-(\alpha*t)} sin\beta*t')

Figure contains an axes object. The axes object with title Stairstep plot of e toThePowerOf -( alpha *t) baseline blank sin beta *t, xlabel t = 0:10 contains 2 objects of type stair, line.

참고 항목

| |