필터 지우기
필터 지우기

how to give title of the legends?

조회 수: 7 (최근 30일)
Muhammad
Muhammad 2021년 10월 2일
댓글: the cyclist 2021년 10월 3일
i have the folowing code that generate step responce of every transfer function in plot i want to give the name of each legend ho i can do
clc
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)
  댓글 수: 2
Muhammad
Muhammad 2021년 10월 2일
clc
clear all
%muhammad sulaman
clc
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')
its giving the error
Error using legend>process_inputs (line 582)
Invalid argument. Type 'help legend' for more
information.
Error in legend>make_legend (line 340)
[autoupdate,orient,location,position,children,listen,strings,propargs]
= process_inputs(ha,argin); %#ok
Error in legend (line 294)
make_legend(ha,args(arg:end),version);
Error in lab2taskno1 (line 19)
legend(sys(1),sys(2),sys(3),sys(4),sys(5),sys(6),sys(7),sys(8),'show')
>>
the cyclist
the cyclist 2021년 10월 3일
clc
clear all
%muhammad sulaman
clc
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({'zeta 0','zeta 00.1','zeta 0.2','zeta 0.5','zeta 0.7','zeta 0.8','zeta 0.9','zeta 1'})

댓글을 달려면 로그인하십시오.

채택된 답변

the cyclist
the cyclist 2021년 10월 2일
You can use the legend function.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by