47 lines
970 B
Mathematica
47 lines
970 B
Mathematica
|
%% 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, '/du'], 1, 'output');
|
||
|
io(4) = linio([mdl, '/dv'], 1, 'output');
|
||
|
|
||
|
%% Run the linearization
|
||
|
rot_speed = 0;
|
||
|
G = linearize(mdl, io, 0.0);
|
||
|
|
||
|
%% Input/Output names
|
||
|
G.InputName = {'Fu', 'Fv'};
|
||
|
G.OutputName = {'Du', 'Dv'};
|
||
|
|
||
|
%% Run the linearization
|
||
|
rot_speed = 2*pi/60;
|
||
|
G1 = linearize(mdl, io, 0.0);
|
||
|
|
||
|
%% Input/Output names
|
||
|
G1.InputName = {'Fu', 'Fv'};
|
||
|
G1.OutputName = {'Du', 'Dv'};
|
||
|
|
||
|
%% Run the linearization
|
||
|
rot_speed = 2*pi;
|
||
|
G2 = linearize(mdl, io, 0.0);
|
||
|
|
||
|
%% Input/Output names
|
||
|
G2.InputName = {'Fu', 'Fv'};
|
||
|
G2.OutputName = {'Du', 'Dv'};
|
||
|
|
||
|
figure;
|
||
|
bode(G, G1, G2);
|
||
|
legend({'$\omega = 0$', '$\omega = 2pi/60$', '$\omega = 2pi$'})
|
||
|
exportFig('G_u_v', 'normal-normal');
|
||
|
|