clc;        %clear console
clear;      %clear workspace
close all;  %close all figures
pkg load control

Cf = 10e-3;   %10mF
L = 5e-3;    %15mH

A = [0 1/Cf;   %system matrix
     -1/L 0];
     
B = [0;1/L];  %input matrix

C = [1 0];    %output matrix
D = [0];      %feedthrough matrix

K = [0 0];    %feedback gain
N = 1;        %prefilter

%**********************************************************
%************************ Tasks ***************************
%**********************************************************

%%task a) set the simulation parameters
sys_ol  = ss(...);
x0      = [...];    %initial state
Tf      = ...;      %simulation time
u_ol    = ...;                           

figure('Name','open loop','NumberTitle','off');
simulate_system(sys_ol,x0,K,N,u_ol,Tf);

%%task b) design an LQR-controller
%Q = [...];                  
%R = ...;
%K = ...;

%%task c) set up closed loop system and simulate
%A_cl    = ...;
%sys_cl  = ss(...);   
%
%figure('Name','closed loop','NumberTitle','off');   %create new plot window
%simulate_system(sys_cl,x0,K,N,0,Tf);

%%task d) simulate closed loop system with additional input
%w = ...;    %we call the input w to distinguish from u
%
%figure('Name','closed loop additional input','NumberTitle','off');;   %create new plot window
%simulate_system(sys_cl,x0,K,N,w,Tf);

%%task e)
%N   = ...;
%w   = ...;
%wN  = ...;
%
%figure('Name','closed loop with reference tracking','NumberTitle','off');
%simulate_system(sys_cl,x0,K,N,w_filt,Tf);