MATLAB: Do I receive an error that the matrix dimensions must agree when I use the PHASE command on a matrix in the System Identification Toolbox

column vectorcomplexphaserow vectorSystem Identification Toolboxtranspose

I have a 50-by-20 complex matrix called mydata. I tried to use the following command:
phase(mydata)
I receive the following error message:
??? Error using ==> plus
Matrix dimensions must agree.
Error in ==> phase at 25
PHI=PHI+2*pi*sign(DF(i))*[zeros(1,i) ones(1,N-i)];

Best Answer

This bug has been fixed for Release 14 SP1 (R14SP1). For previous releases, please read below for any possible workarounds:
This has been verified as a bug in System Identification Toolbox in the way that PHASE command handles matrix input. The error message should indicate that a complex-valued row vector is required as an input.
According to the documentation for the PHASE command, PHASE should only accept a complex-valued row vector as an input. To get the results of a complex matrix, try using the following code instead:
[m,n] = size(mydata);
row_mydata = reshape(mydata,1,m*n);
phase_angle_row = phase(row_mydata);
phase_angle_matrix = reshape(phase_angle_row,m,n);