scripting i/o points for opoen loop analysis
1 view (last 30 days)
Show older comments
Hi, I want to do many linear analysis points in my system, so it is not practical using the Linear Analysis Tool. I am trying to script it but get an error when I try to plot a Nichols graph for some reason ("Error using tf (line 279) The values of the "num" and "den" properties must be row vectors or cell arrays of row vectors, where each vector is nonempty and containing numeric data. Type "help tf.num" or "help tf.den" for more information.") . Help Please!
%%set io points:
op = operpoint(bdroot); %opertain point
io = getlinio(bdroot); %get all I\O defined in the model
set(io, 'Active', 'off');
%%block name, relevant outport num, type
io(1) = linio('pitch/Pitch Control/pitch_est', 1, 'openoutput');
io(2) = linio('pitch/Pitch Control/pitch_c', 1, 'input');
io(3) = linio('pitch/Pitch Control/q', 1, 'openoutput');
io(4) = linio('pitch/Pitch Control/qc', 1, 'openinput');
io(5) = linio('pitch/Servo/de', 1, 'openoutput');
io(6) = linio('pitch/Servo/de_com', 1, 'openinput');
OL = [];
CL = [];
k = 1;
for j = 1 : length(io)/2
set(io,'Active','off'); %deactivate all I/O
set(io(k),'Active','on'); %opens the relevent I/O
set(io(k+1),'Active','on'); %opens the relevent I/O
[OL{j}, CL{j}] = create_OL_CL(bdroot, io, op, j, OL, CL);
k = k + 2;
end
r = j;
w_min = 0.01;
w_max = 40; %set the freq range
for i = 1:r
figure;
nichols(OL{i},{w_min w_max}); hold on; ngrid;
end
%%function [OL, CL] = create_OL_CL(bdroot, io, op, j ,OL, CL)
sys = linearize(bdroot,io,op);
OL{j}=sys;
CL{j}=feedback(OL{j},1);
end
2 Comments
Stefan Raab
on 27 Jan 2016
Hi noa,
have you checked the OL{i} which you pass to the nichols function? Could it be empty?
Siddharth Jawahar
on 10 Oct 2020
Edited: Siddharth Jawahar
on 27 Oct 2020
Hi Noa,
Hope you have figured this issue out. I would like to point out a feature called slLinearizer interface in Simulink Control Design that can help out in such workflows of batch linearization with multiple IO points.
HTH,
Sid
Answers (0)
See Also
Categories
Find more on Linearization in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!