Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
% Control system 1. tf = 1/(s + 2)
% Took approx. 2 seconds for the impulse response to die out.
num = 1; den = [1 2]; t = 0:0.2:2; signal = 'impulse';
y_correct = [1 0.6703 0.4493 0.3012 0.2019 0.1353 0.0907 0.0608 0.0408 0.0273 0.0183]';
y = FirstOrderSystem(num,den,t',signal);
assert(norm(round(y,4) - y_correct)<100*eps)
% Control system 2. tf = 1/(2*s + 2)
% Took approx. 3 seconds for the impulse response to die out.
num = 1; den = [2 2]; t = 0:0.2:3; signal = 'impulse';
y_correct = [0.5000 0.4094 0.3352 0.2744 0.2247 0.1839 0.1506 0.1233 0.1009 0.0826 0.0677 0.0554 0.0454 0.0371 0.0304 0.0249]';
y = FirstOrderSystem(num,den,t',signal);
assert(norm(round(y,4) - y_correct)<100*eps)
% Control system 3. tf = 3/(2*s + 3)
% Took approx. 3 seconds for the impulse response to die out.
num = 3; den = [2 3]; t = 0:0.2:3; signal = 'impulse';
y_correct = [1.5000 1.1112 0.8232 0.6099 0.4518 0.3347 0.2479 0.1837 0.1361 0.1008 0.0747 0.0553 0.0410 0.0304 0.0225 0.0167]';
y = FirstOrderSystem(num,den,t',signal);
assert(norm(round(y,4) - y_correct)<100*eps)
% Control system 4. tf = 1/(2*s + 1)
% Took approx. 6 seconds for the impulse response to die out.
num = 1; den = [2 1]; t = 0:0.5:6; signal = 'impulse';
y_correct = [0.5000 0.3894 0.3033 0.2362 0.1839 0.1433 0.1116 0.0869 0.0677 0.0527 0.0410 0.0320 0.0249]';
y = FirstOrderSystem(num,den,t',signal);
assert(norm(round(y,4) - y_correct)<100*eps)
% Control system 5. tf = 2/(s + 1)
% Took approx. 5 seconds for the impulse response to die out.
num = 2; den = [1 1]; t = 0:0.2:5; signal = 'impulse';
y_correct = [2 1.6375 1.3406 1.0976 0.8987 0.7358 0.6024 0.4932 0.4038 0.3306 0.2707 0.2216 0.1814 0.1485 0.1216 0.0996 0.0815 0.0667 0.0546 0.0447 0.0366 0.0300 0.0246 0.0201 0.0165 0.0135]';
y = FirstOrderSystem(num,den,t',signal);
assert(norm(round(y,4) - y_correct)<100*eps)
|
2 | Pass |
% Control system 1. tf = 1/(s + 2)
% Took approx. 4 seconds to reach a steady state value of 0.5 i.e. an error 0f 0.5 (Undershoot).
num = 1; den = [1 2]; t = 0:0.2:4; signal = 'step';
y_correct = [0 0.1648 0.2753 0.3494 0.3991 0.4323 0.4546 0.4696 0.4796 0.4863 0.4908 0.4939 0.4959 0.4972 0.4982 0.4988 0.4992 0.4994 0.4996 0.4997 0.4998]';
y = FirstOrderSystem(num,den,t',signal);
assert(norm(round(y,4) - y_correct)<100*eps)
% Control system 2. tf = 1/(2*s + 2)
% Took approx. 5 seconds to reach a steady state value of 0.5 i.e. an error of 0.5 (Undershoot).
num = 1; den = [2 2]; t = 0:0.2:5; signal = 'step';
y_correct = [0 0.0906 0.1648 0.2256 0.2753 0.3161 0.3494 0.3767 0.3991 0.4174 0.4323 0.4446 0.4546 0.4629 0.4696 0.4751 0.4796 0.4833 0.4863 0.4888 0.4908 0.4925 0.4939 0.4950 0.4959 0.4966]';
y = FirstOrderSystem(num,den,t',signal);
assert(norm(round(y,4) - y_correct)<100*eps)
% Control system 3. tf = 3/(2*s + 3)
% Took approx. 3 seconds to reach a steady state value of 1 i.e. an error of 0 (accurate).
num = 3; den = [2 3]; t = 0:0.2:3; signal = 'step';
y_correct = [0 0.2592 0.4512 0.5934 0.6988 0.7769 0.8347 0.8775 0.9093 0.9328 0.9502 0.9631 0.9727 0.9798 0.9850 0.9889]';
y = FirstOrderSystem(num,den,t',signal);
assert(norm(round(y,4) - y_correct)<100*eps)
% Control system 4. tf = 1/(2*s + 1)
% Took approx. 10 seconds to reach a steady state value of 1 i.e. an error of 0 (accurate).
num = 1; den = [2 1]; t = 0:0.5:10; signal = 'step';
y_correct = [0 0.2212 0.3935 0.5276 0.6321 0.7135 0.7769 0.8262 0.8647 0.8946 0.9179 0.9361 0.9502 0.9612 0.9698 0.9765 0.9817 0.9857 0.9889 0.9913 0.9933]';
y = FirstOrderSystem(num,den,t',signal);
assert(norm(round(y,4) - y_correct)<100*eps)
% Control system 5. tf = 2/(s + 1)
% Took approx. 6 seconds to reach a steady state value of 2 i.e. an error of -1 (overshoot).
num = 2; den = [1 1]; t = 0:0.2:6; signal = 'step';
y_correct = [0 0.3625 0.6594 0.9024 1.1013 1.2642 1.3976 1.5068 1.5962 1.6694 1.7293 1.7784 1.8186 1.8515 1.8784 1.9004 1.9185 1.9333 1.9454 1.9553 1.9634 1.9700 1.9754 1.9799 1.9835 1.9865 1.9890 1.9910 1.9926 1.9939 1.9950]';
y = FirstOrderSystem(num,den,t',signal);
assert(norm(round(y,4) - y_correct)<100*eps)
|
3 | Pass |
% Control system 1. tf = 1/(s + 2)
% The error t - y(t) of this system continuously grows with time.
num = 1; den = [1 2]; t = 0:0.2:4; signal = 'ramp';
y_correct = [0 0.0176 0.0623 0.1253 0.2005 0.2838 0.3727 0.4652 0.5602 0.6568 0.7546 0.8531 0.9521 1.0514 1.1509 1.2506 1.3504 1.4503 1.5502 1.6501 1.7501]';
y = FirstOrderSystem(num,den,t',signal);
assert(norm(round(y,4) - y_correct)<100*eps)
% Control system 2. tf = 1/(2*s + 2)
% The error t - y(t) of this system continuously grows with time.
num = 1; den = [2 2]; t = 0:0.2:5; signal = 'ramp';
y_correct = [0 0.0094 0.0352 0.0744 0.1247 0.1839 0.2506 0.3233 0.4009 0.4826 0.5677 0.6554 0.7454 0.8371 0.9304 1.0249 1.1204 1.2167 1.3137 1.4112 1.5092 1.6075 1.7061 1.8050 1.9041 2.0034]';
y = FirstOrderSystem(num,den,t',signal);
assert(norm(round(y,4) - y_correct)<100*eps)
% Control system 3. tf = 3/(2*s + 3)
% The error t - y(t) of this system reaches a constant value of 0.667 after approx. 3 seconds.
num = 3; den = [2 3]; t = 0:0.2:3; signal = 'ramp';
y_correct = [0 0.0272 0.0992 0.2044 0.3341 0.4821 0.6435 0.8150 0.9938 1.1781 1.3665 1.5579 1.7515 1.9468 2.1433 2.3407]';
y = FirstOrderSystem(num,den,t',signal);
assert(norm(round(y,4) - y_correct)<100*eps)
% Control system 4. tf = 1/(2*s + 1)
% The error t - y(t) of this system reaches a constant value of 2 after approx. 10 seconds.
num = 1; den = [2 1]; t = 0:0.5:10; signal = 'ramp';
y_correct = [0 0.0576 0.2131 0.4447 0.7358 1.0730 1.4463 1.8475 2.2707 2.7108 3.1642 3.6279 4.0996 4.5775 5.0604 5.5470 6.0366 6.5285 7.0222 7.5173 8.0135]';
y = FirstOrderSystem(num,den,t',signal);
assert(norm(round(y,4) - y_correct)<100*eps)
% Control system 5. tf = 2/(s + 1)
% The error t - y(t) of this system will initially undershoot, then eventually overshoot.
num = 2; den = [1 1]; t = 0:0.2:4; signal = 'ramp';
y_correct = [0 0.0375 0.1406 0.2976 0.4987 0.7358 1.0024 1.2932 1.6038 1.9306 2.2707 2.6216 2.9814 3.3485 3.7216 4.0996 4.4815 4.8667 5.2546 5.6447 6.0366]';
y = FirstOrderSystem(num,den,t',signal);
assert(norm(round(y,4) - y_correct)<100*eps)
|
188 Solvers
the fly, the train, the second train, and their Zeno's paradox
57 Solvers
33 Solvers
English to Pig Latin Translator
57 Solvers
Set some matrix elements to zero
290 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!