how to title the stepplot?
조회 수: 2 (최근 30일)
이전 댓글 표시
how to give title of the each stepplot of transfer function?
i did this and its giving error
clear all
%muhammad sulaman
%19-ee-65
s=tf('s')
wn=0.7;
k=1;
% z=input('enter the value of zeta::');
z=[0 0.1 0.2 0.5 0.7 0.8 0.9 1]
for ii=1:1:8
l=z(ii)
t=linspace(1 ,100,1)
num=k*(wn^2)
den= s^2+2*l*wn*s+wn^2
sys(ii)=num/den
end
stepplot(sys(1),sys(2),sys(3),sys(4),sys(5),sys(6),sys(7),sys(8),t)
legend(sys(1),sys(2),sys(3),sys(4),sys(5),sys(6),sys(7),sys(8),'zeta 0','zeta 00.1','zeta 0.2','zeta 0.5','zeta 0.7''zeta 0.8''zeta 0.9','zeta 1')
댓글 수: 1
Ravi Narasimhan
2021년 10월 3일
편집: Ravi Narasimhan
2021년 10월 3일
I don't have the Toolbox to run your code but I think the legend command does not require the sys(1)...sys(8).
There's an example with legend in the stepplot documentation: https://www.mathworks.com/help/control/ref/lti.stepplot.html
and
legend is described in: https://www.mathworks.com/help/matlab/ref/legend.html
What happens if you try
legend('zeta 0','zeta 00.1','zeta 0.2','zeta 0.5','zeta 0.7''zeta 0.8''zeta 0.9','zeta 1')
채택된 답변
Walter Roberson
2021년 10월 3일
ch = get(gca,'children');
h = flipud(ch(1:7));
legend(h, {'zeta 0','zeta 00.1','zeta 0.2','zeta 0.5','zeta 0.7''zeta 0.8''zeta 0.9','zeta 1'})
This assumes that zeta 0 is intended to match to sys(1)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Title에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!