Hi, I'm having problem to plot my figure when i try to run the program several times to get an average value of rmse. I know there is something wrong the way i save the data for plotting, but i dont know how to solve it.
if i set the no_of_runs more than 1,let say 2 the previous data will still be there and making the data save in the xArray much bigger (1x201), hence the vector of t (1x101 double) and xArray and others will not be the same any more and fail to plot.
how do i make the array will still be (1x101 double) everytime when no_of_runs more than 1? thank you.
tf = 100;
xhatukf1Array = 1;
Pukf1array = diag(Pukf1);
for k=1: no_of_runs
Kukf1 = Pxy1 /(Py1);
xhatukf1 = xhatukf1 + Kukf1 * (z - zhat1);
Pukf1 = Pukf1 - Kukf1 * Py1 * Kukf1';
xArray = [xArray x];
xhatukf1Array = [xhatukf1Array xhatukf1];
Pukf1array = [Pukf1array diag(Pukf1)];
t = 0 : tf;
rmsError_ukf2N(k) = sqrt(inv(tf)*sum((xArray-xhatukf1Array).^(2)));