Why do I get the error "Undefined function 'function name' for input arguments of type 'cell'"

2 views (last 30 days)
For a university assignment I need to compute the fixed modes of a system using a function given to us students by the professor.
The matrices are defined as such:
Atot = [0 -1 -2/3 0 0 0 0
1 0 -2/3 0 0 0 0
-3 0 -3 0 0 0 0
0 1 0 -1 0 0 0
0 0 0 0 -3/2 0 -1/4
0 3/2 0 0 -1 -1 0
0 0 0 0 1 0 -1/2];
Bdec{1}=[0 2 4 0 0 2 0]';
Bdec{2}=[0 0 0 -1 0 0 0]';
Bdec{3}=[0 0 0 0 1 -2 0;
0 0 0 0 0 -1 0]';
Ctot=eye(7);
Cdec{1}=Ctot(1:3,:);
Cdec{2}=Ctot(4,:);
Cdec{3}=Ctot(5:7,:);
And the function takes as input:
function [Difm]=di_fixed_modes(Atot,Baggr,Caggr,N,ContStruc,rounding_n)
% Computes the fixed modes of the system, with reference to the control
% information structure specified by 'ContStruc'.
%
% Inputs:
% - Atot: system matrix - either continuous-time or discrete-time.
% - Baggr: input matrices - either continuous-time or discrete-time -
% (i.e., Baggr{1},..., Baggr{N} are the input matrices of the decomposed system, one for each channel).
% - Caggr: output matrices - either continuous-time or discrete-time -
% (i.e., Caggr{1},..., Caggr{N} are the output matrices of the decomposed
% system, one for each channel).
% - N: number of subsystems.
% - ContStruc: NxN matrix that specifies the information structure
% constraints (ContStruc(i,j)=1 if communication is allowed between channel
% j to channel i, ContStruc(i,j)=0 otherwise).
% - rounding_n: the eigenvalues are rounded at the nth decimal place
%
% Output:
% - Difm: vector containing the fixed modes (if empty, there are no FMs)
But when I call the function this error "Undefined function 'di_fixed_modes' for input arguments of type 'cell'" appears, even though the function is designed for the cell type of input for the matrices B and C. This is the only part where they're used:
Btot=[];
Ctot=[];
for i=1:N
m(i)=size(Baggr{i},2);
p(i)=size(Caggr{i},1);
Btot=[Btot,Baggr{i}];
Ctot=[Ctot
Caggr{i}];
end
  2 Comments
Voss
Voss on 21 Jan 2022
Could it be that di_fixed_modes.m is not on the MATLAB path? Type this on the command line and see what comes back:
which di_fixed_modes -all
Giosuè Basso
Giosuè Basso on 22 Jan 2022
Thank you so much, of course it was this easy.
Now the problem is understanding why no fixed modes are returned but I guess I'll need to figure it out by myslef.
Thanks again

Sign in to comment.

Answers (0)

Products


Release

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!