Why is my table array not outputting?!
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
Below is a copy of my code. I can not figure out why the code will not output my table, if you can help it will be most appreciated.
-Robert
CODE:
wn = 5;
za = (5/sqrt(2))/(2*wn);
zb = 5/(2*wn);
zc = (5*sqrt(2))/(2*wn);
zd = (5*sqrt(3))/(2*wn);
ze = 12/(2*wn);
% Peak Times
Tp = [pi/(wn*sqrt(1-za^2)),
pi/(wn*sqrt(1-zb^2)),
pi/(wn*sqrt(1-zc^2)),
pi/(wn*sqrt(1-zd^2)),
pi/(wn*sqrt(1-ze^2))]
% Settling Time
Ts = [4/(za*wn),
4/(zb*wn),
4/(zc*wn),
4/(zd*wn),
4/(ze*wn)]
OptimalSystems = {'System A';'System B','System C','System D','System E'};
Gain = [5/sqrt(2) 5 5*sqrt(2) 5*sqrt(3) 12];
PeakTime = [Tp(1) Tp(2) Tp(3) Tp(4) Tp(5)];
SettlingTime = [Ts(1) Ts(2) Ts(3) Ts(4) Ts(5)];
T = table(OptimalSystems,Gain,PeakTime,SettlingTime)
댓글 수: 0
채택된 답변
Star Strider
2018년 9월 27일
Try this slight variation:
OptimalSystems = {'System_A','System_B','System_C','System_D','System_E'};
Gain = [5/sqrt(2) 5 5*sqrt(2) 5*sqrt(3) 12]';
PeakTime = [Tp(1) Tp(2) Tp(3) Tp(4) Tp(5)]';
SettlingTime = [Ts(1) Ts(2) Ts(3) Ts(4) Ts(5)]';
T = table(Gain,PeakTime,SettlingTime, 'RowNames',OptimalSystems)
T =
5×3 table
Gain PeakTime SettlingTime
______ ________________ ____________
System_A 3.5355 0.6717+0i 2.2627
System_B 5 0.72552+0i 1.6
System_C 7.0711 0.88858+0i 1.1314
System_D 8.6603 1.2566+0i 0.92376
System_E 12 0+0.94723i 0.66667
댓글 수: 0
추가 답변 (1개)
KSSV
2018년 9월 27일
There were some typo errors and dimension problems.....corrected.
wn = 5;
za = (5/sqrt(2))/(2*wn);
zb = 5/(2*wn);
zc = (5*sqrt(2))/(2*wn);
zd = (5*sqrt(3))/(2*wn);
ze = 12/(2*wn);
% Peak Times
Tp = [pi/(wn*sqrt(1-za^2)),
pi/(wn*sqrt(1-zb^2)),
pi/(wn*sqrt(1-zc^2)),
pi/(wn*sqrt(1-zd^2)),
pi/(wn*sqrt(1-ze^2))]
% Settling Time
Ts = [4/(za*wn),
4/(zb*wn),
4/(zc*wn),
4/(zd*wn),
4/(ze*wn)]
OptimalSystems = {'System A';'System B';'System C';'System D';'System E'};
Gain = [5/sqrt(2) 5 5*sqrt(2) 5*sqrt(3) 12]';
PeakTime = [Tp(1) Tp(2) Tp(3) Tp(4) Tp(5)]';
SettlingTime = [Ts(1) Ts(2) Ts(3) Ts(4) Ts(5)]';
T = table(OptimalSystems,Gain,PeakTime,SettlingTime)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!