45 lines
874 B
Matlab
45 lines
874 B
Matlab
%% Open Simulink file
|
|
open rotating_frame.slx
|
|
|
|
%% Options for Linearized
|
|
options = linearizeOptions;
|
|
options.SampleTime = 0;
|
|
|
|
%% Name of the Simulink File
|
|
mdl = 'rotating_frame';
|
|
|
|
%% Input/Output definition
|
|
io(1) = linio([mdl, '/fu'], 1, 'input');
|
|
io(2) = linio([mdl, '/fv'], 1, 'input');
|
|
|
|
io(3) = linio([mdl, '/dx'], 1, 'output');
|
|
io(4) = linio([mdl, '/dy'], 1, 'output');
|
|
|
|
%% Run the linearization
|
|
rot_speed = 2*pi;
|
|
G = linearize(mdl, io, 0.0);
|
|
|
|
%% Input/Output names
|
|
G.InputName = {'Fu', 'Fv'};
|
|
G.OutputName = {'Dx', 'Dy'};
|
|
|
|
%% Run the linearization
|
|
G1 = linearize(mdl, io, 0.4);
|
|
|
|
%% Input/Output names
|
|
G1.InputName = {'Fu', 'Fv'};
|
|
G1.OutputName = {'Dx', 'Dy'};
|
|
|
|
%% Run the linearization
|
|
G2 = linearize(mdl, io, 0.8);
|
|
|
|
%% Input/Output names
|
|
G2.InputName = {'Fu', 'Fv'};
|
|
G2.OutputName = {'Dx', 'Dy'};
|
|
|
|
figure;
|
|
bode(G, G1, G2);
|
|
exportFig('G_u_v_to_x_y', 'wide-tall');
|
|
|
|
|