DENOMINATOR = [1 5 1];
sim("sim_simulink_for_control")

sim_round1 = sim("sim10_simulink_for_control");

DENOMINATOR = [1 0.5 1];
sim_round2 = sim("sim10_simulink_for_control");

% plot(sim_round1.response_timeseries)
% plot(sim_round2) % opens simulation data inspector

plot(sim_round1.response_timeseries.Time, sim_round1.response_timeseries.Data, 'r', 'DisplayName', 'Non-oscillating')
hold on;
plot(sim_round2.tout, sim_round2.response_timeseries.Data, 'k', 'DisplayName', 'Oscillating')
legend

hold off;

figure
% plot(sim_round1.responses_timeseries)
% plot(sim_round1.responses_timeseries.Time, sim_round1.responses_timeseries.Data, 'r', 'DisplayName', 'Non-oscillating')
plot(sim_round1.responses_timeseries.Time, sim_round1.responses_timeseries.Data(:, 1), 'r', 'DisplayName', 'Minimal phase non-oscillating')
hold on
plot(sim_round1.responses_timeseries.Time, sim_round1.responses_timeseries.Data(:, 2), 'b', 'DisplayName', 'Non-minimal phase non-oscillating')

legend
hold off

figure
% plot(sim_round2.responses_structure) % does not work
plot(sim_round2.responses_structure.time, sim_round2.responses_structure.signals.values(:, 1), 'y', 'DisplayName', 'Minimal phase non-oscillating')
hold on

plot(sim_round2.responses_structure.time, sim_round2.responses_structure.signals.values(:, 2), 'g', 'DisplayName', 'Non-minimal phase non-oscillating')
legend

hold off

figure
% plot(sim_round2.responses_structure) % does not work
plot(sim_round2.ScopeData2.time, sim_round2.ScopeData2.signals(1).values(:, 2), 'm', 'DisplayName', 'Non-minimal phase non-oscillating')
hold on

plot(sim_round2.ScopeData2.time, sim_round2.ScopeData2.signals(2).values(:, 1), 'c', 'DisplayName', 'Excitation')

legend

hold off

figure
% plot(sim_round2.responses_structure) % does not work
plot(sim_round2.ScopeData3{1}.Values.Time, sim_round2.ScopeData3{1}.Values.Data(:, 1), 'r', 'DisplayName', 'Minimal phase non-oscillating')
hold on

plot(sim_round2.ScopeData3{2}.Values.Time, sim_round2.ScopeData3{2}.Values.Data(:, 1), 'b', 'DisplayName', 'Excitation')

legend

hold off
