Ivan, no for é
<span style="font-family:arial,helvetica,sans-serif;font-size:16px"><font color="#ff0000"><b>for(t in 1:n)</b></font>, sem querer coloquei 2 ali. No caso o erro é nas dimensões da matriz? Só que o ar_A está sendo multiplicado, e ele vai ficar na mesma dimensão de D. No caso o array ar_A tem n+1 e o os outros tem n, só que seria a previsão.</span><div>
<font face="arial, helvetica, sans-serif" size="3"><br></font></div><div><font face="arial, helvetica, sans-serif" size="3"><br></font></div><div><font face="arial, helvetica, sans-serif" size="3"><br></font></div><div><font face="arial, helvetica, sans-serif" size="3">Abraços!</font></div>
<div><font face="arial, helvetica, sans-serif" size="3"><br></font></div><div><font face="arial, helvetica, sans-serif" size="3"><br></font></div><div><font face="arial, helvetica, sans-serif" size="3"><br></font><br><div class="gmail_quote">
Em 14 de maio de 2012 09:39, Ivan Bezerra Allaman <span dir="ltr"><<a href="mailto:ivanalaman@yahoo.com.br" target="_blank">ivanalaman@yahoo.com.br</a>></span> escreveu:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="font-size:12pt;font-family:arial,helvetica,sans-serif"><div><span>O erro é claro!</span></div><div><br><span></span></div><div><span>Verifique a linha que eu grifei em vermelho no seu código. As dimensão do objeto "ar_A e ar_D" estão diferentes, impossibilitando a subtração.</span></div>
<div><br><span></span></div><div><span>.</span></div><div><span>.</span></div><div class="im"><div><span>.</span></div><div><span style="white-space:pre-wrap"> </span>for(t in 1:2){</div><div><span style="white-space:pre-wrap"> </span><span style="background-color:rgb(255,0,0)">ar_U[,,t]<-ar_Y[,,t]-ar_Z[,,t,drop=FALSE]%*%<span style="font-weight:bold;color:rgb(255,255,0)">ar_A[,,t,drop=FALSE]-ar_D[,,t,drop=FALSE]</span></span></div>
<div><span style="white-space:pre-wrap"> </span>ar_F[,,t]<-ar_Z[,,t,drop=FALSE]%*%ar_P[,,t,drop=FALSE]%*%t(ar_Z[,,t,drop=FALSE])+ar_H[,,t,drop=FALSE]</div><div><span style="white-space:pre-wrap"> </span>ar_AA[,,t]<-ar_A[,,t,drop=FALSE]+ar_P[,,t,drop=FALSE]%*%ar_Z[,,t,drop=FALSE]%*%ginv(ar_F[,,t,drop=FALSE])%*%ar_U[,,t,drop=FALSE]</div>
<div><span style="white-space:pre-wrap"> </span>ar_PP[,,t]<-ar_P[,,t,drop=FALSE]-ar_P[,,t,drop=FALSE]%*%t(ar_Z[,,t,drop=FALSE])%*%ginv(ar_F[,,t,drop=FALSE])%*%ar_Z[,,t,drop=FALSE]%*%ar_P[,,t]</div><div>
<span style="white-space:pre-wrap"> </span>ar_A[,,t+1]<-ar_T[,,t,drop=FALSE]%*%ar_AA[,,t,drop=FALSE]+ar_C[,,t,drop=FALSE]</div><div><span style="white-space:pre-wrap"> </span>ar_P[,,t+1]<-ar_T[,,t,drop=FALSE]%*%ar_PP[,,t,drop=FALSE]%*%t(ar_PP[,,t,drop=FALSE])+ar_R[,,t,drop=FALSE]%*%ar_Q[,,t,drop=FALSE]%*%t(ar_R[,,t,drop=FALSE])</div>
<div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>}</div><div><span style="white-space:pre-wrap"> </span>return(list(ar_A,ar_P))</div>
<div>}</div><div><br></div></div><div>Filtro_Kalman(ar_Z,ar_T,ar_C,ar_D,ar_R,ar_H,ar_Q,a1,p1)<br><br>(S,f,P)<br>Allaman<br></div><div> </div><div style="background-color:transparent" align="center"><font style="background-color:transparent" face="comic sans ms" size="2"><font size="1"><b><br>
</b></font></font></div><div style="text-align:left;background-color:transparent" align="center"><font style="background-color:transparent"><font face="courier, monaco, monospace, sans-serif">\begin{signature}</font></font></div>
<div style="text-align:left;background-color:transparent" align="center"><font style="background-color:transparent"><font face="courier, monaco, monospace, sans-serif"><<>>=</font></font></div><div style="text-align:left;background-color:transparent" align="center">
<font face="courier, monaco, monospace, sans-serif">Prof. Dr. Ivan Bezerra Allaman</font></div><div style="text-align:left;background-color:transparent" align="center"><font face="courier, monaco, monospace, sans-serif">Universidade Estadual de Santa Cruz</font></div>
<div style="text-align:left;background-color:transparent" align="center"><font face="courier, monaco, monospace, sans-serif">Departamento de Ciências Exatas e Tecnológicas</font></div><div style="text-align:left;background-color:transparent" align="center">
<font face="courier, monaco, monospace, sans-serif">Ilhéus/BA - Brasil</font></div><div style="text-align:left;background-color:transparent" align="center"><font face="courier, monaco, monospace, sans-serif">Fone: <a href="tel:%2B55%2073%203680-5596" value="+557336805596" target="_blank">+55 73 3680-5596</a></font></div>
<div style="text-align:left;background-color:transparent" align="center"><font face="courier, monaco, monospace, sans-serif">E-mail: <a href="http://ivanalaman@yahoo.com.br/ivanalaman@gmail.com" target="_blank">ivanalaman@yahoo.com.br/ivanalaman@gmail.com</a></font></div>
<div style="text-align:left;background-color:transparent" align="center"><font style="background-color:transparent"><font face="courier, monaco, monospace, sans-serif">@</font></font></div><div style="text-align:left;background-color:transparent" align="center">
<font style="background-color:transparent"><font face="courier, monaco, monospace, sans-serif">\end{signature}</font></font></div></div></div><br>_______________________________________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div><br></div>