nass-simscape/Control/control_y.m
2018-06-13 09:37:20 +02:00

35 lines
500 B
Matlab

%%
load('./mat/G_f_to_d.mat', 'G_f_to_d');
%%
G = G_f_to_d(2, 2);
%% Try sisotool
sisotool(G)
%%
gain = 1e9;
%%
bodeFig({gain*G}, struct('phase', true))
%%
[~,~,~,Wpm] = margin(gain*G);
Wpm = 200*2*pi;
%%
s = tf('s');
C = gain*(s/(0.2*Wpm)+1)/(s/(10*Wpm)+1)/(1+s/(2*pi*100));%*(s+2*pi*10)/(s+2*pi*0.0001);
%% Compute Closed loop transfer function
bodeFig({C*G}, struct('phase', true))
%%
K = tf(zeros(6));
K(2,2) = C;
%%
save('./mat/controller.mat', 'K')