Why is my table array not outputting?!

1 Ansicht (letzte 30 Tage)
Robert  Flores
Robert Flores am 27 Sep. 2018
Beantwortet: KSSV am 27 Sep. 2018
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)

Akzeptierte Antwort

Star Strider
Star Strider am 27 Sep. 2018
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

Weitere Antworten (1)

KSSV
KSSV am 27 Sep. 2018
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)

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by