%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
close all
clc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%% Model Reduction of Dynamical Systems %%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%% Summer Semester 2019 %%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Exercise 4, Problem 1b : Rational interpolation (multi-point)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
load('beam.mat');
% Step 1 - Plot full model transfer function
fstart = 10^-3; fend = 10^3;
f = logspace(log10(fstart), log10(fend), 1000);
for k = 1 : length(f)
end
figure;
loglog();
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SISO system interpolation
% Step 2 - Implement implicit moment matching algorithm
r = % Order of reduced system
sigma = % Choose the interpolation point
% Get V, W
% Reduced matrices of the system
Ar = (W'*A*V);
Br = (W'*B);
Cr = C*V;
% Step 3 - Frequency response of reduced system
fstart = 10^-3; fend = 10^3;
f = logspace(log10(fstart), log10(fend), 1000);
for k = 1 : length(f)
end
loglog();
% Step 3 - Plot error between full and reduced model
figure;
loglog();