close all

figure;
plot(w_r.time,w_r.signals.values(:,1),'b','LineWidth',2);
hold on;
plot(w_r.time,w_r.signals.values(:,2),'r','LineWidth',2);
xlabel('t [s]');
ylabel('w_r [rad/s]');
legend('required','measured')
grid on;

figure
subplot(2,1,1)
plot(I_dq.time,I_dq.signals(1).values(:,1),'b','LineWidth',2)
hold on;
plot(I_dq.time,I_dq.signals(1).values(:,2),'r');
xlabel('t [s]');
ylabel('Id [A]');
legend('required','measured');
grid on;

subplot(2,1,2)
plot(I_dq.time,I_dq.signals(2).values(:,1),'b','LineWidth',2)
hold on;
plot(I_dq.time,I_dq.signals(2).values(:,2),'r');
xlabel('t [s]');
ylabel('Iq [A]');
legend('required','measured');
grid on;

figure;
subplot(3,1,1)
plot(p_s.time,p_s.signals(1).values(:,1),'b','LineWidth',2);
xlabel('t [s]');
ylabel('U DCbus [V]');
legend('U DCbus')
grid on;

subplot(3,1,2)
plot(p_s.time,p_s.signals(2).values(:,1),'b');
hold on;
plot(p_s.time,p_s.signals(2).values(:,2),'r');
hold on;
plot(p_s.time,p_s.signals(2).values(:,3),'k');
xlabel('t [s]');
ylabel('Duty cycles [-]');
legend('phase A','phase B','phase C');
grid on;

subplot(3,1,3)
plot(p_s.time,p_s.signals(3).values(:,1),'b');
hold on;
plot(p_s.time,p_s.signals(3).values(:,2),'r');
hold on;
plot(p_s.time,p_s.signals(3).values(:,3),'k');
xlabel('t [s]');
ylabel('Output from inverter [V]');
legend('phase A','phase B','phase C');
grid on;