How to update old matlab code sel and pck
8 views (last 30 days)
Show older comments
BEMNET WONDIMAGEGNEHU MERSHA
on 2 Mar 2020
Commented: irem ipek
on 30 Oct 2023
I am working on something related with control and I tried to use complex model equation developed by an old matlab version. The resource uses 'sel' and 'pck' code. I believe the 'pck' code is the same as the 'ss' code for state space representation of systems. What does the 'sel' do in this code below? Here this is just part of the code, I have corrected the others
SS_hi = ss(A_hi,B_hi,C_hi,D_hi);
SS_lo = ss(A_lo,B_lo,C_lo,D_lo);
%% Make MATLAB matrix
%%
mat_hi = [A_hi B_hi; C_hi D_hi];
mat_lo = [A_lo B_lo; C_lo D_lo];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Longitudal Directional %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Select the components that make up the longitude A matrix
%%
A_longitude_hi = sel(mat_hi,[3 5 7 8 11 13 14], [3 5 7 8 11 13 14]);
A_longitude_lo = sel(mat_lo,[3 5 7 8 11 13 14], [3 5 7 8 11 13 14]);
%% Select the components that make up the longitude B matrix
%%
B_longitude_hi = sel(mat_hi,[3 5 7 8 11 13 14], [19 20]);
B_longitude_lo = sel(mat_lo,[3 5 7 8 11 13 14], [19 20]);
%% Select the components that make up the longitude C matrix
%%
C_longitude_hi = sel(mat_hi,[21 23 25 26 29], [3 5 7 8 11 13 14]);
C_longitude_lo = sel(mat_lo,[21 23 25 26 29], [3 5 7 8 11 13 14]);
%% Select the components that make up the longitude D matrix
%%
D_longitude_hi = sel(mat_hi,[21 23 25 26 29], [19 20]);
D_longitude_lo = sel(mat_lo,[21 23 25 26 29], [19 20]);
SS_long_hi = ss(A_longitude_hi, B_longitude_hi, C_longitude_hi, D_longitude_hi);
SS_long_lo = ss(A_longitude_lo, B_longitude_lo, C_longitude_lo, D_longitude_lo);
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Lateral Directional %%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Select the components that make up the lateral A matrix
%%
A_lateral_hi = sel(mat_hi,[4 6 7 9 10 12 13 15 16], [4 6 7 9 10 12 13 15 16]);
A_lateral_lo = sel(mat_lo,[4 6 7 9 10 12 13 15 16], [4 6 7 9 10 12 13 15 16]);
%% Select the components that make up the lateral B matrix
%%
B_lateral_hi = sel(mat_hi,[4 6 7 9 10 12 13 15 16], [19 21 22]);
B_lateral_lo = sel(mat_lo,[4 6 7 9 10 12 13 15 16], [19 21 22]);
%% Select the components that make up the lateral C matrix
%%
C_lateral_hi = sel(mat_hi,[22 24 25 27 28 30], [4 6 7 9 10 12 13 15 16]);
C_lateral_lo = sel(mat_lo,[22 24 25 27 28 30], [4 6 7 9 10 12 13 15 16]);
%% Select the components that make up the lateral D matrix
%%
D_lateral_hi = sel(mat_hi,[22 24 25 27 28 30], [19 21 22]);
D_lateral_lo = sel(mat_lo,[22 24 25 27 28 30], [19 21 22]);
SS_lat_hi = ss(A_lateral_hi, B_lateral_hi, C_lateral_hi, D_lateral_hi);
SS_lat_lo = ss(A_lateral_lo, B_lateral_lo, C_lateral_lo, D_lateral_lo);
%% Make longitudal direction SYSTEM matrix
%%
sys_long_hi = pck(A_longitude_hi, B_longitude_hi, C_longitude_hi, D_longitude_hi);
sys_long_lo = pck(A_longitude_lo, B_longitude_lo, C_longitude_lo, D_longitude_lo);
3 Comments
Manuel Ayala
on 18 May 2020
Hello, How did you solve this problem? What is the function "sel" and "pck"
Thanks
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!