Home > other >  MATLAB prony algorithm has some problems
MATLAB prony algorithm has some problems

Time:09-20

I found in the script order p change will result in an error is related original data have great god can solve the

Script:
The function [F, D, A, theta]=exprony_ma (y, p, dt)
Nm=2 * p; % % % p for the model of order
N=fix (length (y)/2); % % % % 0 as the direction of integer
H=y (1, 1, 2 * n) ';
L=length (h);
M=L/2;
For k=1: nm
X1 (:, k)=h (k, M - 1 + k);
End
For k=1: M
X2 (k, :)=- h + k (nm);
End
B=x1, x2, % % least-square method solving the prony polynomial coefficient
B (nm + 1)=1;
B1=B (nm + 1: - 1:1);
V=roots (B1); % % o characteristic equation of the root
F1=abs (log (V))/(2 * PI * dt);
% % a preliminary calculation frequencyD1=log (abs (V))/(2 * PI * dt); Attenuation factor
% % a preliminary calculationFor k=0: (2 * n - 1)
Va (k + 1)=conj '(V). ^ k; % % fei have matrix Va
End
S1=2 * (inv (conj (Va) * Va) * conj (Va ') * h); % % % % % % b
[F2, I]=sort (F1); % % % frequency F1 since the childhood to sort in descending order
M=0;
For k=1:1 nm -
If F2 (k) ~=F2 (k + 1) % % to remove the conjugate item
continue;
End
M=m + 1;
Ii=I (k); Ordinal % % extract effective element
F (m)=F1 (ii);
D (m)=D1 (ii);
A (m)=abs (S1) (ii);
Theta (m)=Angle (S1) (ii) * 180/PI;
End
Result=[A (m), F (m) D (m) is (m)];


Feel very strange change the length of the initial data will also be an error if there is something wrong with the program itself.

CodePudding user response:

Elder brother, you don't need to build a sample matrix

CodePudding user response:

Have already established good,,,
  • Related