%% Finite-dimensional Koopman linearization % Example from the Data-driven Science and Engineering book by Brunton & % Kutz, 2019, page 262. %% Parameters lambda = 1; mu = -0.1; x0 = [-6; 6]; %% Linearization of the nonlinear model at [0; 0] A1 = [mu 0; 0 lambda]; B1 = [0; 1]; C1 = eye(2,2); D1 = zeros(2,1); %% Koopman (global) linearization A2 = [mu 0 0; 0 lambda -lambda; 0 0 2*mu]; B2 = [0; 1; 0]; C2 = [1 0 0; 0 1 0]; D2 = zeros(2,1); %% LQR design for the linearized model Q1 = 10*eye(2,2); R1 = 1; K1 = lqr(A1,B1,Q1,R1) %% LQR design for the Koopman model Q2 = 10*eye(3,3); Q2(3,3) = 0; R2 = 1; K2 = lqr(A2,B2,Q2,R2)