hello Dr.Yi
This code is working good for N<=150
but when N exceeds this limit, a nonsense happens
Is there any improvement to the code considering this error?

@ Matthew (Jun 28)
I had the same problem (with P growing exponentially). Like you said: this has to do with the Alpha parameter. It has to do with how the Unscented Transform calculates its transformed mean. In certain cases (I think when measurement covariance is very low, and process covariance is a few orders of magnitude greater), there can be some rounding errors in Matlab, which causing the transformed mean to come up short.
To fix this, I changed the UT function to be like this:
~~~~~~~~~~
function [y,Y,P,Y1] = ut(f,X,Wm,Wc,n,R)
L=size(X,2);
% y=zeros(n,1); % LINE COMMENTED OUT HERE
Y=zeros(n,L);
for k=1:L
Y(:,k)=f(X(:,k));
% y=y+Wm(k)*Y(:,k); % LINE COMMENTED OUT HERE
end
y = mean([Y(:,1)'; mean(Y(:,2:end)')]); % LINE ADDED HERE
Y1=Y-y(:,ones(1,L));
P=Y1*diag(Wc)*Y1'+R;

Somehow only the first state is tracked correctly. The estimate of x(2) and x(3) is always almost zero no matter how I change the model. Clearly there is a bug...

Comment only