53 lines
1.0 KiB
Mathematica
53 lines
1.0 KiB
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, '/fx'], 1, 'input');
|
||
|
io(2) = linio([mdl, '/fy'], 1, 'input');
|
||
|
|
||
|
io(3) = linio([mdl, '/dx'], 1, 'output');
|
||
|
io(4) = linio([mdl, '/dy'], 1, 'output');
|
||
|
|
||
|
%% Run the linearization
|
||
|
angle_e = 0; rot_speed = 0;
|
||
|
G = linearize(mdl, io, 0);
|
||
|
|
||
|
%% Input/Output names
|
||
|
G.InputName = {'Fx', 'Fy'};
|
||
|
G.OutputName = {'Dx', 'Dy'};
|
||
|
|
||
|
%% Run the linearization
|
||
|
angle_e = 0; rot_speed = 2*pi;
|
||
|
Gr = linearize(mdl, io, 0);
|
||
|
|
||
|
%% Input/Output names
|
||
|
Gr.InputName = {'Fx', 'Fy'};
|
||
|
Gr.OutputName = {'Dx', 'Dy'};
|
||
|
|
||
|
|
||
|
%% Run the linearization
|
||
|
angle_e = 1*2*pi/180; rot_speed = 2*pi;
|
||
|
Ge = linearize(mdl, io, 0);
|
||
|
|
||
|
%% Input/Output names
|
||
|
Ge.InputName = {'Fx', 'Fy'};
|
||
|
Ge.OutputName = {'Dx', 'Dy'};
|
||
|
|
||
|
%%
|
||
|
f = figure('visible', 'off');
|
||
|
bode(G);
|
||
|
exportFig('G_x_y', 'wide-tall');
|
||
|
close(f);
|
||
|
|
||
|
figure;
|
||
|
bode(Ge);
|
||
|
% exportFig('G_x_y_e', 'normal-normal');
|
||
|
|