CIS2-Admittance-Control / get_TF_system.m
get_TF_system.m
Raw
% This function grabs the linearized Transfer function from input to 
% output nodes which are strings denoted by 'Input' 'Output' 'ControllerModel'
% (not including .file_extension)
% Created by Brevin Banks
% Modified 3/7/2023
% Inputs
%   Input - the starting input ref node of the loop in the simulink file
%   Output - the ending output signal node of the loop in the simulink
%   file
%   ControllerModel - the name of the simulink slx file as string not including
%   .slx
% Output
%   TFout - the output desired transfer function from the simulink
%   model
function TFout = get_TF_system(Input,Output,ControllerModel)

addmit_con = ControllerModel;
open_system(addmit_con); % Open the slx file
sllin = slLinearizer(addmit_con); % open the model linearizer
addPoint(sllin,{Input,Output}); % Add the query nodes
sysout = getIOTransfer(sllin,Input,Output); % grab the transfer function
TFout = tf(sysout); % output the tf function
end