tag:blogger.com,1999:blog-16931740211470703502024-03-20T18:27:41.167-07:00Programación en C, C++, MatLab y PASCAL sobre ingeniería, cálculo y BigDataResolución de distintos problemas en el ámbito de la ingenieria mediante el uso de la programación. Los programas abarcan todos los niveles de dificultad, así como la mayoría de las herramintas con las que contamos al programar. Si tienes cualquier duda a cerca de un programa, o quieres proponer alguna nueva entrada, no dudes en contactar escribiendo en cualquiera de las entradas del blog ¡Bienvenido!Unknownnoreply@blogger.comBlogger70125tag:blogger.com,1999:blog-1693174021147070350.post-70276133143501003812017-02-27T12:34:00.000-08:002017-02-27T12:43:25.879-08:00Tracking de objetos en video mediante filtro de Kalman (MATLAB)<div class="MsoNormal">
<span lang="ES"><b><u>TRACKING DE VIDEO MEDIANTE KALMAN</u></b><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="ES"><b><u><br /></u></b></span></div>
<div class="MsoNormal">
<span lang="ES">En este programa
se lleva a cabo el tracking de personas y objetos en un video. Para llevar a
cabo esta acción se han utilizado llevado a cabo tres etapas principales.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="ES"><br /></span></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="ES">-<span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"> - </span></span><!--[endif]--><span lang="ES">Primero,
detección de los puntos en movimiento. Para ello se ha optado por la solución más sencilla
posible, que es la de realizar la <b>diferencia entre dos frames consecutivos</b> del
video. El mayor problema de este método es su sensibilidad al ruido, razón por
la que se realiza también un filtrado.<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<span lang="ES"><br /></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="ES">-<span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"> - </span></span><!--[endif]--><span lang="ES">Segundo,
un método de segmentación que nos permite distinguir los distintos objetos que
hay en la escena. En este caso se ha optado por el método de <b>k-means o isodata</b>.
Se podría haber utilizado en principio cualquier otro método de clusters o
segmentación.<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<span lang="ES"><br /></span></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="ES">-<span style="font-size: 7pt; font-stretch: normal; font-variant-numeric: normal; line-height: normal;"> - </span></span><!--[endif]--><span lang="ES">Tercero,
<b>filtro de Kalman</b> de manera que se mejora el seguimiento de los objetos, y además
se solucionan problemas asociados a la superposición de objetos o desaparición
temporal de los mismos. Se ha optado por una descripción del sistema de segundo
orden (aceleración constante).<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<span lang="ES"><br /></span></div>
<div class="MsoNormal">
<span lang="ES">El funcionamiento
del programa se explica con mayor detalle en el código que viene a
continuación. Este es el único código necesario para la ejecución del programa.</span></div>
<div class="MsoNormal">
<span lang="ES"><br /></span></div>
<div class="MsoNormal">
<span lang="ES">Como video de
entrada se ha utilizado el siguiente:</span><br />
<span lang="ES"><iframe allowfullscreen="" frameborder="0" height="344" src="https://www.youtube.com/embed/u_LjNSoUuMo" width="459"></iframe></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="ES">El video
resultado es el mostrado a continuación:<o:p></o:p></span></div>
<div class="MsoNormal">
<iframe allowfullscreen="" frameborder="0" height="344" src="https://www.youtube.com/embed/uKK8cmP5yp4" width="459"></iframe></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
El código en Matlab:</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% README: Este es el único código necesario para la ejecución del programa.</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Es necesario que en el mismo directorio en el que se encuentre el</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% programa exista un video en formato mp4 llamado Visor_Humains.mp4. Sino</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% basta con cambiar la parte inicial del código del programa para adecuarlo</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% a cada situación</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">clear </span><span lang="ES" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">all</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">close </span><span lang="ES" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">all</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">clc;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%% 0.0 Se cargan los datos correspondientes al video en una estructura</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% denominada video</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">video = VideoReader(</span><span lang="ES" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Visor_Humains.mp4'</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">frames=video.read();</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span style="font-family: "courier new"; font-size: 10pt;"> k=1:video.NumberOfFrames</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> video_fr(k).cdata =
squeeze(frames(:,:,:,k));</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">longueur_sequence=video.NumberOfFrames;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 0.0.1 Se cambia de RGB a nivel de grises para facilitar el tratamiento</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">Width=video.Width ;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">Height=video.Height;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">video_fr_gray=zeros(Height,Width,longueur_sequence);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span style="font-family: "courier new"; font-size: 10pt;"> i=1:longueur_sequence</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> video_fr_gray(:,:,i) =
rgb2gray(video_fr(i).cdata);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%% 0.1 Descripción del sistema para Kalman</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">num_estados=6;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">num_salidas=4;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Descripción del vector de estado</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% x(1)-Position horizontal</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% x(2)-Position vertical</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% x(3)-Velocidad Horizontal</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% x(4)-Velocidad Vertical</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% x(5)-Dimensión horizontal del objeto</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% x(6)-Dimensión vertical del objeto</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">Dt=1; </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% En realidad debería ser fijado a 1/25
de segundos (25 frames por s)</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Se utiliza una descripción de segundo orden (suponemos aceleración cte)</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">A_est=[1 0 Dt 0
0 0;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> 0 1
0 Dt 0 0;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> 0 0
1 0 0 0;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> 0 0
0 1 0 0;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> 0 0
0 0 1 0;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> 0 0
0 0 0 1];</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Se han añadido al estado las dimensiones del objeto</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="DE" style="font-family: "courier new"; font-size: 10pt;">H=[1 0 0 0 0 0;</span><span lang="DE" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="DE" style="font-family: "courier new"; font-size: 10pt;"> 0 1 0 0 0 0;</span><span lang="DE" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="DE" style="font-family: "courier new"; font-size: 10pt;"> 0 0 0 0 1 0;</span><span lang="DE" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="DE" style="font-family: "courier new"; font-size: 10pt;"> 0 0 0 0 0 1];</span><span lang="DE" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="DE" style="font-family: "courier new"; font-size: 10pt;">sigma_v_est=1e-0;</span><span lang="DE" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">sigma_w_est=2e-5;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Valores que se han fijado de manera heuristica para un mejor</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% comportamiento en el video del ejemplo</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">R=diag([0.5*sigma_v_est 1*sigma_v_est 0.1*sigma_v_est 0.1*sigma_v_est]);</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">Q=diag([0.3*sigma_w_est 0.01*sigma_w_est</span><span lang="FR" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> 0.1*sigma_w_est sigma_w_est
10*sigma_w_est 10*sigma_w_est]);</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%% 0.2 PArametros del video</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">init_frame=2;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">temps=0.04; </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Tiempo entre frames</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">num_frames=900;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">total_frames=size(video_fr_gray,3);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%% 0.3 Otros parámetros</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Tipo de filtro que se aplica para suavizar el efecto del ruido a la hora</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% de detectar los puntos en movimiento</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">filt = fspecial(</span><span lang="ES" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'gaussian'</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">,15);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Valor mínimo de la diferencia entre dos frames para considerar que existe</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% movimiento en la escena</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">threshold=55;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Nombre máximo de objetos que se pueden detectar en la escena</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">max_obj=5;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%% 0.4 Inicialización de la estructura objeto y de parametros del filtro de</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Kalman</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> i=1:max_obj</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 0.4.1 Inicialización de los objetos</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% .presence inica la presencia del objeto en la escena, esté visible o</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% no. El objeto no está presente al inicio</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> objet(i).presence=false;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% .visibilite indica si el objeto está visible o no, ya que puede ser</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% que este en la escena pero esté oculto por la superposición con otro</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% objeto. Inicialmente no visible.</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> objet(i).visibilite=false;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Número de frames en los que el objeto no ha sido visualizado en los</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% últimos frames</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> objet(i).non_visual=0;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Posición del objeto</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> objet(i).position=[0 0]';</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 0.4.1 Inicialización de los parámetros para el filtro de Kalman</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Vector de estado estimado</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">
objet(i).x_est=zeros(num_estados,init_frame+num_frames);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Vector de estado proyectado</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">
objet(i).x_proy=squeeze(objet(i).x_est(:,1));</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> objet(i).z=zeros(num_salidas,1);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> objet(i).P_proy=Q; </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Proyección de la covarianza</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Número de objetos presentes en la escena</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">num_obj_presents=0;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Mínimo número de pixels en los que se detecta movimiento para suponer que</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% de verdad hay movimiento en la escena y no es ruido.</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">min_point_mov=100;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Número máximo de frames en los que el objeto no ha sido visualizado y a</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% partir del cual suponemos que el objeto ha desaparecido de la escena</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">max_frames_non_visual=12;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Distancia mínima (medida en pixels) a partir de la cual se supone que dos</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% clusters detectados son en realidad el mismo</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">dist_min=80;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Distancia mínima entre un objeto que se esta visualizando, y un la</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% posición estimada de un objeto para suponer que son el mismo</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">dist_min_2=80;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%--------------------------------------------------------------------------</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%%
---------------------------BOUCLE GENERAL-------------------------------</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%--------------------------------------------------------------------------</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">frame(init_frame-1).num_obj_presents=0;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span style="font-family: "courier new"; font-size: 10pt;">
i=init_frame:(init_frame+num_frames)</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 1. Se
obtiene la diferencia entre dos frames consecutivos</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">diff =
squeeze(video_fr_gray(:,:,i))-squeeze(video_fr_gray(:,:,i-1));</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 2.
Filtramos la diferencia para eliminar el ruido</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="DE" style="font-family: "courier new"; font-size: 10pt;">diff_filt=filter2(filt,diff,</span><span lang="DE" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'same'</span><span lang="DE" style="font-family: "courier new"; font-size: 10pt;">);</span><span lang="DE" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="DE" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="DE" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="DE" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 3. Se hace un threshold</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">
frame(i).moving=(abs(diff_filt)>threshold);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 4. Se busca
el número de objetos visibles en la escena mediante</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% técnicas de clusters (Aquí K-Means). Se supone que los objetos</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% únicamente se mueven en horizontal, de manera que consideramos</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% unicamente su proyección sobre el eje horizontal, minimizando el</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% coste computacional</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> [row,col] = find(frame(i).moving==1);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> xbins1 = 0:size(diff_filt,2);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> [counts,centers]=hist(col,xbins1);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> num_objets=0;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> frame(i).num_objets_detec=0;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> frame(i).num_objets=0;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">if</span><span style="font-family: "courier new"; font-size: 10pt;">
((~isempty(col))&&(size(col,1)>min_point_mov))</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 4.1
Se realiza un clusterizado para el nombre máximo de objetos</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% que puede haber en la escena</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">[aux.idx,aux.C,sum_clust]=</span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> kmeans(col,max_obj,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'EmptyAction'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'singleton'</span><span style="font-family: "courier new"; font-size: 10pt;">);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">aux_old.idx=aux.idx;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 4.2 Se fusionan los objetos que están muy próximos</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="DE" style="font-family: "courier new"; font-size: 10pt;">Dist_Mat=zeros(max_obj);</span><span lang="DE" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="DE" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span style="font-family: "courier new"; font-size: 10pt;"> num=1:max_obj</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span style="font-family: "courier new"; font-size: 10pt;"> j=num:max_obj</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Se construye la matriz de distancias entre clusters</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="DE" style="font-family: "courier new"; font-size: 10pt;">Dist_Mat(num,j)=abs(aux.C(num)-aux.C(j));</span><span lang="DE" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="DE" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span style="font-family: "courier new"; font-size: 10pt;">;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span style="font-family: "courier new"; font-size: 10pt;">;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> Dist_Mat=Dist_Mat';</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%
Dist_Mat_2 contiene 1 si los objetos de la columna y de la línea</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% son el mismo objeto. Guardamos la mitad inferior puesto que es</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% simétrica.</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> Dist_Mat_2=tril((Dist_Mat<dist_min).*(Dist_Mat>0));</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% La líneas de obj_agrup indican los nuevos inidices de los objetos</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% que han sido agrupados, mientras que las columnas son el</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% resultado del k-mean original.</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> obj_agrup=zeros(max_obj,max_obj);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% agrup(k) indica si los clusters de salida de k-means han sido</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% clasificados</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> agrup=zeros(1,max_obj);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">num_obj=0;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span style="font-family: "courier new"; font-size: 10pt;"> num=1:max_obj</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">if</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> (agrup(num)==0)</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Se marca como agrupado</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> agrup(num)=1;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Se aumenta el número de objetos agrupados</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> num_obj=num_obj+1;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Se indican los clusters que forman el objeto</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">
obj_agrup(num_obj,num)=1;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Se
miran las columnas de Dist_Mat para ver que clusters</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% están próximos</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> j=num+1:max_obj</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">if</span><span style="font-family: "courier new"; font-size: 10pt;">
(Dist_Mat_2(j,num)==1)</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Se marca como agrupado y se indica a qué grupo</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% pertenece</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> agrup(j)=1;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">
obj_agrup(num_obj,j)=1;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Se buscan los grupos que están próximos</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span style="font-family: "courier new"; font-size: 10pt;"> jj=1:num</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">if</span><span style="font-family: "courier new"; font-size: 10pt;"> (Dist_Mat(j,jj)==1)</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> agrup(jj)=1;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">
obj_agrup(num_obj,jj)=1;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span style="font-family: "courier new"; font-size: 10pt;">;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span style="font-family: "courier new"; font-size: 10pt;">;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span style="font-family: "courier new"; font-size: 10pt;">;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span style="font-family: "courier new"; font-size: 10pt;">;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span style="font-family: "courier new"; font-size: 10pt;">;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Una vez agrupados todos los clusters y encontrados todos los</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% objetos, se actualiza la tabla de índices</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">old=aux.idx;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> new=zeros(size(old));</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span style="font-family: "courier new"; font-size: 10pt;"> num=1:num_obj</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span style="font-family: "courier new"; font-size: 10pt;"> j=1:max_obj</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">if</span><span style="font-family: "courier new"; font-size: 10pt;"> (obj_agrup(num,j)==1)</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> [row_g,col_g]=find(old==j);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> new(row_g,col_g)=num;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Se calculan los nuevos centros</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">n_i=sum(new==num);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> aux.C(num)=sum(col.*(new==num))/n_i;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> aux.idx=new;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% OSe actualiza el número de objetos</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">frame(i).num_objets=num_obj;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 5.
Se calcula el tamañó de cada objeto para poder dibujar un</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%
rectangulo a su alrededor</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span style="font-family: "courier new"; font-size: 10pt;"> num=1:frame(i).num_objets</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> temp=row.*(aux.idx==num);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> temp=temp(find(temp~=0));</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> bottom(num) = max(temp);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> top(num) = min(temp);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">temp=col.*(aux.idx==num);</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">temp=temp(find(temp~=0));</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> right(num) = max(temp);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">left(num) = min(temp);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Se guardan los centro de los objetos</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">frame(i).centres(num,1)=(right(num)+left(num))/2;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> frame(i).centres(num,2)=(bottom(num)+top(num))/2;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 6. Hacer la relación entre los objetos observados y los objetos</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% estimados mediante Kalman</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%Se define una estructura objeto con los siguientes atribujots:</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% - presencia: (booleano) Indica si el objeto está en la escena incluso</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% si este no puede ser visto porque
otro objeto se encuentra delante</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% suyo. Este sería el caso de
cuando dos personas se cruzan en la</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% escena.</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% - visibilite: (booleano) Se utiliza para inidcar si el objeto</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% presente está visible o no.</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% - non_visual: (int) Es el número de veces que le objeto no ha sido</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% visto de manera consecutiva. Si
este valor superca cierto límite</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% previamente establecido, el
objeto se considera que ha</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% desaparecido. Si este valor es
menor que ese límite se considera</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% que el objeto está presente pero
no visible.</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% - x_est: Es el vector de estado estimado por Kalman para determinado</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% objeto</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% - x_proy: Es el vector de estado proyectado por Kalman para</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% determinado objeto.</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% - z: Es la observación correspondiente al objeto</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% - P_proy: Es la proyección para el próximo estado de la matriz de</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% covarianza</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Haremos por lo tanto un array de tamaño el número máximo de objetos</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% que se suponen que se pueden encontrar en la escena</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 6.1 Primero se van a comparar los objetos estimados con Kalman con</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% los objetos observados. De esta manera se va a construir una matriz </span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Dist_Vis_Pres, con las distancias entre los objetos visto y los</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% objetos presentes</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> frame(i).num_obj_presents=0;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
Rel_Vis_Pres=zeros(max_obj,max_obj);</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> Dist_Vis_Pres=[];</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Si no se ven objetos se ponen las visibilidades a cero</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">if</span><span style="font-family: "courier new"; font-size: 10pt;"> (frame(i).num_objets==0)</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> j=1:max_obj</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">
objet(j).visibilite=false;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Se verifica que el objeto ha sido visto últimamemente, si no</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% se hace reset del objeto</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">if</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">
(objet(j).non_visual>=max_frames_non_visual)</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">objet(j).presence=false;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(j).visibilite=false;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(j).non_visual=0;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> objet(j).position=[0
0]';</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> objet(j).x_est=zeros(num_estados,init_frame+num_frames);</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(j).x_proy=squeeze(objet(j).x_est(:,1));</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">objet(j).z=zeros(num_salidas,1);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">objet(j).P_proy=Q;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span style="font-family: "courier new"; font-size: 10pt;">;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span style="font-family: "courier new"; font-size: 10pt;">;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span style="font-family: "courier new"; font-size: 10pt;">;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span style="font-family: "courier new"; font-size: 10pt;"> num=1:frame(i).num_objets</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> j=1:max_obj</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Se verifica que el objeto ha sido visto últimamemente, si no</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% se hace reset del objeto</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">if</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">
(objet(j).non_visual>=max_frames_non_visual)</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">objet(j).presence=false;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(j).visibilite=false;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(j).non_visual=0;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> objet(j).position=[0
0]';</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(j).x_est=zeros(num_estados,init_frame+num_frames);</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(j).x_proy=squeeze(objet(j).x_est(:,1));</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">objet(j).z=zeros(num_salidas,1);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> objet(j).P_proy=Q;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% _Si el objeto está presente se calcula la distancia con el</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% objeto visto</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">if</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> (objet(j).presence==true)</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% MaMatriz de distancia entre los objetos vistos y</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% presentes</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> Dist_Vis_Pres(num,j)=</span><span lang="FR" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
abs(frame(i).centres(num,1)-objet(j).position(1));</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">else</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% MaMatriz de distancia entre los objetos vistos y</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% presentes</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
Dist_Vis_Pres(num,j)=inf;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Una vez que hemos encontrado las distancias entre los objetos</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% vistos y estimados, hacemos la relación entre los dos, de manera</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% que al objeto presente le corresponda el objeto visto más próximo</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% a él, verificando siempre que esta distancia sea mayor que la</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% distancia límite a partir de la cual suponemos que dos objetos</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% son el mismo objeto (dist_min_2)</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">if</span><span style="font-family: "courier new"; font-size: 10pt;">
isempty(Dist_Vis_Pres)</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Si no había objetos presentes antes, pero ha sido detectado</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% un objeto, se crea un nuevo objeto presente, fijando que la</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% distancia mínima es infinito.</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> aux2=inf;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">else</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
aux2=min(squeeze(Dist_Vis_Pres(num,:)));</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span style="font-family: "courier new"; font-size: 10pt;">;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">if</span><span style="font-family: "courier new"; font-size: 10pt;"> (aux2<dist_min_2)</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 6.1.1 Se ha encontrado una correspondencia:</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Se
hace la relación entr el objeto presente y visto</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">Rel_Vis_Pres(num)=find(squeeze(Dist_Vis_Pres(num,:))==aux2);</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(Rel_Vis_Pres(num)).visibilite=true;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Se actualizan los atributos del objeto:</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Outputs/Observaciones:</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(Rel_Vis_Pres(num)).z=[frame(i).centres(num,1)</span><span lang="FR" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">frame(i).centres(num,2)
abs(right(num)-left(num))</span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> abs(bottom(num)-top(num))]';</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Posción:</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(Rel_Vis_Pres(num)).position=[frame(i).centres(num,1)</span><span lang="FR" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">frame(i).centres(num,2)]';</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Como se acaba de ver el objeto se pone el contador de no</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% visible a cero.</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">
objet(Rel_Vis_Pres(num)).non_visual=0;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">else</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 6.1.2 Si no se ha hecho ninguna correspondencia entre vistos</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% y presentes, se crea un nuevo objeto.</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">trouve=false;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> cont=0;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">while</span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> (~trouve)</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> cont=cont+1;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">if</span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> (objet(cont).presence==false)</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> trouve=true;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(cont).presence=true;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(cont).visibilite=true;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(cont).non_visual=0;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> objet(cont).x_est(:,i)=[frame(i).centres(num,1)</span><span lang="FR" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">frame(i).centres(num,2)</span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> 0 0 </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">
abs(right(num)-left(num))</span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">
abs(bottom(num)-top(num))]';</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">objet(cont).position=squeeze(objet(cont).x_est(1:2,i));</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(cont).x_proy=squeeze(objet(cont).x_est(:,i));</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(cont).z=[frame(i).centres(num,1)</span><span lang="FR" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">frame(i).centres(num,2)
abs(right(num)-left(num))</span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">
abs(bottom(num)-top(num))]';</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">objet(cont).P_proy=Q;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 7. Se utiliza el fltro de Kalman para todos los objetos una vez que</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% se ha realizado la buena correspondencia entre los objetos vistos y</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% estimados</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> num=1:max_obj</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">if</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> (objet(num).presence &&
objet(num).visibilite)</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Se dá mayor o meno importancia a las observaciones</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% dependiendo de donde se ha visto el objeto (Idea es eliminar</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% los efectos de borde)</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">if</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">
((objet(num).z(1)<50)||(objet(num).z(1)>(Width-125)))</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">R_k=0.1*R;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> Q_k=10*Q;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">else</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> R_k=R;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">Q_k=Q;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 7.1 Si el objeto está presente ha
sido visualizado, se</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% procede con kalman utilizando la descripción del sistema</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 7.1.1 Cálculo de la ganancia de Kalman</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">objet(num).G=</span><span lang="FR" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(num).P_proy*(H')/(H*objet(num).P_proy*(H')+R_k);</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 7.1.2 Actualización del estado</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">
objet(num).x_est(:,i)=objet(num).x_proy+</span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">objet(num).G*(objet(num).z-H*objet(num).x_proy);</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 7.1.3 Actualización de la matriz de covarianza del error de</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% estimación</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> objet(num).P_est=</span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">
objet(num).P_proy*(eye(num_estados)-(H')*(objet(num).G'));</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 7.1.4 Proyeccion del vector de estado para el proximo</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% instante</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(num).x_proy=A_est*objet(num).x_est(:,i);</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 7.1.5 Proyección de la matriz de covarianza</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">objet(num).P_proy=A_est*objet(num).P_est*(A_est')+Q_k;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(num).position=squeeze(objet(num).x_est(1:2,i));</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">elseif</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> objet(num).presence</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 7.2 Si el objeto esta presente pero no visible (No existen</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% observaciones en este caso). Únicamente se puede utilizar el</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%
modelo para estimar la posición.</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 7.2.1 Se aumenta el número de frames en los que no ha sido</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% visto el objeto presente</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">
objet(num).non_visual=objet(num).non_visual+1;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 7.2.2 Se aplican las ecuaciones del sistema</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">objet(num).x_est(:,i)=objet(num).x_proy;</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(num).x_proy=A_est*objet(num).x_est(:,i);</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
objet(num).position=squeeze(objet(num).x_est(1:2,i));</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">else</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 7.3 El objeto no está presente</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 8. Se muestran los puntos en movimiento</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">figure_1=figure(1);</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> pause(0.01); </span><span lang="FR" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 25 frames par second</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">imshow(uint8(video_fr_gray(:,:,i)));
hold </span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">on</span><span style="font-family: "courier new"; font-size: 10pt;">;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> color=[1 0 0;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> 0 0 1;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> 0 1 0;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> 0.5 0 0.5;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> 0 0.5 0.5;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> 0.5 0.5 0;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> 0 0 0;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> ];</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span style="font-family: "courier new"; font-size: 10pt;"> j=1:max_obj</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">if</span><span style="font-family: "courier new"; font-size: 10pt;"> objet(j).presence</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">if</span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
((objet(j).x_est(5,i)~=0)&&(objet(j).x_est(6,i)~=0))</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> rectangle(</span><span lang="FR" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Position'</span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">,[(objet(j).x_est(1,i)-objet(j).x_est(5,i)/2)</span><span lang="FR" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
(objet(j).x_est(2,i)-objet(j).x_est(6,i)/2)</span><span lang="FR" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> objet(j).x_est(5,i)
objet(j).x_est(6,i)],</span><span lang="FR" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'EdgeColor'</span><span style="font-family: "courier new"; font-size: 10pt;">,squeeze(color(j,:)),</span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'LineWidth'</span><span style="font-family: "courier new"; font-size: 10pt;">,3);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">strmax = [</span><span lang="FR" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Objet '</span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">,num2str(j)];</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
text((objet(j).x_est(1,i)-objet(j).x_est(5,i)/2),</span><span lang="FR" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;">
(objet(j).x_est(2,i)-objet(j).x_est(6,i)/2-20),</span><span lang="FR" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">strmax,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'HorizontalAlignment'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'left'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Color'</span><span style="font-family: "courier new"; font-size: 10pt;">,squeeze(color(j,:)));</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span style="font-family: "courier new"; font-size: 10pt;">;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span style="font-family: "courier new"; font-size: 10pt;">;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span style="font-family: "courier new"; font-size: 10pt;">;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> num_objets=sum([objet(1:end).presence]);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">title(sprintf(</span><span lang="FR" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Nombre d objets %i'</span><span lang="FR" style="font-family: "courier new"; font-size: 10pt;">,num_objets));</span><span lang="FR" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="FR" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">axis </span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">tight</span><span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">manual</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> set(gca,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'nextplot'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'replacechildren'</span><span style="font-family: "courier new"; font-size: 10pt;">);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="ES">
</span></div>
<div class="MsoNormal">
<span lang="ES">Espero que les
sea útil, un saludo (Remarcar que ciertas palabras puede que se encuentren en francés)<o:p></o:p></span></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1693174021147070350.post-64160131779679337842016-12-02T10:04:00.001-08:002016-12-02T10:09:25.983-08:00Técnica ESPRIT para la estimación de DOA en Matlab<div class="MsoNormal">
<span lang="ES">Aquí se presenta
el código para el método ESPRIT en Matlab.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="ES">ESPRIT es un
método utilizado para estimar la dirección de llegada de una o más señales, mediante
el uso de un array de sensores compuesto por duplas (doublets). Las señales que
son captadas por los sensores cuentan con ruido. Para poder separar este ruido
de la señal, se busca maximizar la proyección de estas señales de entrada en
una base ortogonal, la cual expanda un espacio de igual dimensión al número de
fuentes. </span>Este método funciona
para señales con una banda frecuencial (frequency bandwidth) pequeña, limitación prinicipal respecto a otros métodos como es MUSIC. Para información mas detallada ver la referencia al final de la entrada.</div>
<div class="MsoNormal">
<span lang="ES"><br /></span></div>
<div class="MsoNormal">
<span lang="ES">Se presentan dos
códigos. El primero, en el que se ejecuta una realización para distintas
estructuras de arrays, muestra gráficamente la estimación de dos fuentes en el
caso 2D:<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="ES"><br /></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">clearvars </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">-except</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">RXX_2</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">clc;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">close </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">all</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">rng </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">shuffle</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">twpi = 2.0*pi;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">derad = pi / 180.0;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">radeg = 180.0 / pi;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">c=3*10^8;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% the speed of light</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%% 1. Scenarion parameters</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 1.1 Source Definition</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">w1=2e6;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Frequency source 1</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">w2=1e6;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Frequency source 2</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">w0=1e9;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Carrier Frequency</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">amp=1; </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Signal amplitude</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">angles=[20,-60];
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Sources Angles (degrees)</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">theta = derad*angles;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">lambda0=c*twpi/w0;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">SNR=5;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">var_n=amp/(10^(SNR/10));</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">sigma_n=sqrt(var_n);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 1.2 Array Geometry</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">N = 9; </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%
(-) elements number array</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">delta=[1 0]*lambda0/4;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% distance between doublets</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">d=lambda0/2;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Separation between doublets</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% delta=[2 0]; %
distance between doublets</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% d=4;%lambda0/2; </span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">delta_mod=((delta(1)^2+delta(2)^2)^0.5);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">type_array=</span><span lang="ES" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'random'</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">if</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> strcmp(type_array,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'ULA'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">)</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 1.1.1 Linear array</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> Pos=zeros(2,N);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> Pos(1,:)=0:d:(N-1)*d;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">Pos(2,:)=zeros(1,N);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">elseif</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> strcmp(type_array,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Y'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">)</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 1.1.2 Y-array</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> angleY=[30 150 270]*derad;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> j=1:3</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">
Pos(1,((j-1)*(N/3)+1):(j*(N/3)))=(d:d:(N/3)*d)*cos(angleY(j));</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">
Pos(2,((j-1)*(N/3)+1):(j*(N/3)))=(d:d:(N/3)*d)*sin(angleY(j));</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Y-array (120º)</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% \ /</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% \ /</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% \ /</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% \ /</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% +</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% |</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% |</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% |</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% |</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">elseif</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> strcmp(type_array,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'square'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">)</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 1.1.3 Square-array</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> Row=3;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> Col=2;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> N=Row*Col;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> Pos=zeros(2,N);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> j=1:Row</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> k=1:Col</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">
Pos(1,(j-1)*Col+k)=(k-1)*d;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">Pos(2,(j-1)*Col+k)=(j-1)*d;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Square-array (5x4)</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% +---+---+---+</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% | |
| |</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% +---+---+---+</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% | |
| |</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% +---+---+---+</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% | |
| |</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% +---+---+---+</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% | |
| |</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% +---+---+---+</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">elseif</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> strcmp(type_array,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'random'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">)</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 1.1.4 random-array</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> N=5;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> j=1:N</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> Pos(1,j)=d*rand;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> Pos(2,j)=d*rand;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">elseif</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> strcmp(type_array,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'paper'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">)</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 1.1.5 Linear array and scenario Paper (pag. 993)</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">N = 5;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> Pos=zeros(2,N);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">
Pos(1,:)=[0,1,3,5.5,7]*(lambda0/2);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> delta=[1 0]*(lambda0/4);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">
delta_mod=((delta(1)^2+delta(2)^2)^0.5);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> angles=[24 28];</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> theta = derad*angles;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> SNR=0;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> var_n=amp/(10^(SNR/10));</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> sigma_n=sqrt(var_n);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Take into account Rayleigh of 3dBs</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 1.3 Simulation parameters</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">n=100;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% sample number</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">N_cov=1;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Number of meassures for calculate
the cov matrix</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 1.4. Generate Input Sampled Signal</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">Ts=1e6;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 1MHz</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">Fs=1/Ts;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">t=linspace(0,Ts,n);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">phase=0.5;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% The sources don't arrive at the
same moment</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">s1=amp*exp(1i*w1*t);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">s2=amp*exp(1i*w2*t);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">s=[s1.*exp(w0*1i*t);s2.*exp(w0*1i*t+phase)];</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">theta_delta=atan(delta(2)/delta(1));</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% We use the relative angle between the direction of arrival and the
delta vector</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">gamma=(w0*delta_mod/c)*[sin(theta(1)-theta_delta)
sin(theta(2)-theta_delta)];</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">gamma1=gamma;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">tau=zeros(2,N);
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Genereal case</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> i=1:N</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">tau(1,i)=(Pos(:,1)-Pos(:,i))'*[-sin(theta(1)); cos(theta(1))]; </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% /c</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> tau(2,i)=(Pos(:,1)-Pos(:,i))'*[-sin(theta(2));
cos(theta(2))]; </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% /c</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">i=sqrt(-1);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">a1 = exp(2i*pi*tau(1,:)');</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">a2 = exp(-2i*pi*tau(2,:)');</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">A=[a1 a2];</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">phi=diag(exp(1i*gamma));</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%% 2. Calculate the cov matrix of z=[x;y]</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">Z=zeros(2*N,n,N_cov);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">RZZ=zeros(2*N,2*N);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">x = zeros(N,n,N_cov);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">y=x;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> j=1:N_cov</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">
x(:,:,j)=A*s+sigma_n*randn(N,n);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">
y(:,:,j)=A*phi*s+sigma_n*randn(N,n);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> Z=[x(:,:,j);y(:,:,j)];</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> RZZ=RZZ+Z*Z';</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">RZZ=RZZ/(N*N_cov);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">[U,D,V] = svd(RZZ);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%% 3. Estimate number of sources</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% We keep at least the 95% of the energy</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">D2=diag(D*conj(D));</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">Energy=sum(D2);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">threshold=0.98;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">D2_cumu=0;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">j=0;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">while</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> (D2_cumu<(threshold*Energy))</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">j=j+1;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> D2_cumu=D2_cumu+D2(j);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">num_sources=j;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% num_sources=2;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%% 3. Determine Sources</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">ES=U(:,1:num_sources);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">EX=ES(1:N,:);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">EY=ES(N+1:2*N,:);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">psi=pinv(EX)*EY; </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%??</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">phi=eigs(psi);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">gamma_est=angle(phi);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">angles_est=asin(gamma_est*c/(w0*delta_mod))*radeg;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%% 4. Result Display</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% -------------------------Graphic configuration---------------------------</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Propiedades de las figuras (cm)</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Size</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">width = 18; </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 18 para DIN A4</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">height = 17;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">width_line=2;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">width_dot=3;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Margins</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">margin_left = 1.5; </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%0.95;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">margin_right = 0.25; </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%0.25;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">margin_top = 3;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">margin_bottom = 1.2;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Font</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">font_name = </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Times'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">; </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Times,
Helvetica</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">font_size = 12.0; </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Tamaño de fuente (ejes)</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">legend_font_size = 10.0; </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Tamaño de
fuente (leyenda)</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">title_font_size = 16.0; </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Tamaño de
fuente del título (leyenda)</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">marker_size = 6; </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Tamaño de los
marcadores</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">color=[[1 0 0];[0 1 0];[0 0 1];[0 1 1];[1 0 1];[1 1 0]];</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% -------------------end graphic
configuration-----------------------------</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">r=0:1:10;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 4.1 Array geometry</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">figure(1)</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">clf;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">position = [1 2 width height];</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">set(gcf,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Units'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'centimeters'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Position'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,position,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'PaperUnits'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'centimeters'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'PaperPosition'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,position,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'PaperPositionMode'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'auto'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Crear ejes</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">axesposition = [margin_left, margin_bottom,
position(3)-margin_left-margin_right position(4)-margin_bottom-margin_top];</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">axes(</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'FontSize'</span><span style="font-family: "courier new"; font-size: 10pt;">,font_size,</span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Units'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'centimeters'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'FontName'</span><span style="font-family: "courier new"; font-size: 10pt;">,font_name,</span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Position'</span><span style="font-family: "courier new"; font-size: 10pt;">,axesposition);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">hold </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">on</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">; grid </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">on</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">plot(Pos(1,:),Pos(2,:),</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'+'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'LineWidth'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,width_dot,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Color'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'black'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">hold </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">on</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">plot(Pos(1,:)+delta(1),Pos(2,:)+delta(2),</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'x'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'LineWidth'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,width_dot,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Color'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'black'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 4.2 Sources</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">mid_point=[(min(Pos(1,:))+max(Pos(1,:)))/2
(min(Pos(2,:))+max(Pos(2,:)))/2];</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> j=1:num_sources</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">
plot(mid_point(1)-r*sin(angles(j)*derad),mid_point(2)+r*cos(angles(j)*derad),</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'-.r'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'LineWidth'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,width_line);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 4.3 Sources Estimation</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> j=1:num_sources</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">
plot(mid_point(1)-r*sin(angles_est(j)*derad),mid_point(2)+r*cos(angles_est(j)*derad),</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'LineWidth'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,width_line);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span style="font-family: "courier new"; font-size: 10pt;">;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">axis([min(Pos(1,:))-2
max(Pos(1,:))+2 min(Pos(2,:))-2 max(Pos(2,:))+2]);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">title(sprintf(</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Direction of
Arrival Estimation (SNR %3.1f)\n(Source 1: %3.1f Source Est. 1: %3.1f)
\n(Source 2: %3.1f Source Est. 1: %3.1f)\n'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> SNR,angles(1), angles_est(1), angles(2),
angles_est(2)),</span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'interpreter'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'latex'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'HorizontalAlignment'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'center'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'FontSize'</span><span style="font-family: "courier new"; font-size: 10pt;">,title_font_size);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">my_legend = {</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'x doublet'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'y doublet'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Source 1'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Source 2'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Est. Source
1'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Est. </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">Source 2'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">};</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">aux=legend(my_legend,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Interpreter'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'latex'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'FontSize'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,12,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Orientation'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Vertical'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Units'</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="ES" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'centimeters'</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="ES" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Location'</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="ES" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'southeast'</span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal">
<span lang="ES">El segundo,
muestra un análisis de Monte-Carlo para distintas configuraciones de ULAs en un
escenario de SNR=5. Se hace variar el tamaño del array viendo cómo varían los resultados.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%% Montecarlo Analysis for ESPRIT estimation</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">clearvars;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">clc;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">close </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">all</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">rng </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">shuffle</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">; </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Initializate the seed of random numbers</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">num_simu=3000;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Simulations number</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">twpi = 2.0*pi;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">derad = pi / 180.0;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">radeg = 180.0 / pi;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">c=3*10^8;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% the speed of light</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%% 1. Scenarion parameters</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 1.1 Source Definition</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">w1=2e6;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Frequency source 1</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">w2=1e6;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Frequency source 2</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">w0=1e9;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Carrier Frequency</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">amp=1;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Signal amplitude</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">angles=[24,28];
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Sources Angles (degrees)</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">theta = derad*angles;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">lambda0=c*twpi/w0;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">SNR=10;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% We set the SNR</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">var_n=(amp^2)/(10^(SNR/10));
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% We calculate the variance</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">sigma_n=sqrt(var_n);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 1.2 Array Geometry</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">delta=[1 0]*lambda0/4;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% distance between doublets</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">d=lambda0/2;
</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Separation between doublets</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">delta_mod=((delta(1)^2+delta(2)^2)^0.5);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%% We compare the three architectures</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">num_architectures=4;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">angles_est=zeros(2,num_simu,num_architectures);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">names={</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'ULA (2 Doublets)'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'ULA2 (4
Doublets)'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'ULA3
(6 Doublets)'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'ULA4
(8 Doublets)'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">};</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">N=0;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> comp=1:num_architectures</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> type_array=names(comp)</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> N=N+2;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 1.1.1 Linear array 1</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> d=5;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">Pos=zeros(2,N);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> Pos(1,:)=0:d:(N-1)*d;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">Pos(2,:)=zeros(1,N);<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 1.3 Simulation parameters</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> n=100; </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% sample number</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> N_cov=1; </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Number of meassures for calculate the cov matrix</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 1.4. Generate Input Sampled Signal</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> Ts=1e6; </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 1MHz</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">Fs=1/Ts;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">
t=linspace(0,Ts,n);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">phase=0.5; </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% The sources don't arrive at the same moment</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> s1=amp*exp(1i*w1*t);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> s2=amp*exp(1i*w2*t);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">
s=[s1.*exp(w0*1i*t);s2.*exp(w0*1i*t+phase*1i)];</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">theta_delta=atan(delta(2)/delta(1));</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% We use the relative angle between the direction of arrival and the
delta vector</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">gamma=(w0*delta_mod/c)*[sin(theta(1)-theta_delta)
sin(theta(2)-theta_delta)];</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">gamma1=gamma;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> tau=zeros(2,N); </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Genereal case</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> i=1:N</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">tau(1,i)=(Pos(:,1)-Pos(:,i))'*[-sin(theta(1));
cos(theta(1))]; </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% /c</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">
tau(2,i)=(Pos(:,1)-Pos(:,i))'*[-sin(theta(2)); cos(theta(2))]; </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% /c</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> i=sqrt(-1);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> a1 = exp(2i*pi*tau(1,:)');</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> a2 = exp(-2i*pi*tau(2,:)');</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> A=[a1 a2];</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> phi=diag(exp(1i*gamma));</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;"> %% Simulation Star</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> simu=1:num_simu</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;"> %% 2. Calculate the cov
matrix of z=[x;y]</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">Z=zeros(2*N,n,N_cov);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> RZZ=zeros(2*N,2*N);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> x = zeros(N,n,N_cov);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">y=x;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> j=1:N_cov</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">
x(:,:,j)=A*s+sigma_n*randn(N,n);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">
y(:,:,j)=A*phi*s+sigma_n*randn(N,n);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> Z=[x(:,:,j);y(:,:,j)];</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> RZZ=RZZ+Z*Z';</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> RZZ=RZZ/(N*N_cov);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> [U,D,V] = svd(RZZ);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;"> %% 3. Estimate number of
sources</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% We dont estimate here the number sources</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">num_sources=2;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;"> %% 4. Determine Sources</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> ES=U(:,1:num_sources);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> EX=ES(1:N,:);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 10pt;">EY=ES(N+1:2*N,:);</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> psi=pinv(EX)*EY;</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;"> </span><span style="font-family: "courier new"; font-size: 10pt;">phi_est=eigs(psi);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> gamma_est=angle(phi_est);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">
angles_est(:,simu,comp)=asin(gamma_est*c/(w0*delta_mod))*radeg;</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%% Plot histogram</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% -------------------------Graphic
configuration---------------------------</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Propiedades de las figuras (cm)</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Size</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">width = 18; </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% 18 para DIN A4</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">height = 17;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Margins</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">margin_left = 1.5; </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%0.95;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">margin_right = 0.25; </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">%0.25;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">margin_top = 2.6;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">margin_bottom = 1.2;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Font</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">font_name = </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Times'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">; </span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Times,
Helvetica</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">font_size = 12.0; </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Tamaño de fuente (ejes)</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">legend_font_size = 10.0; </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Tamaño de
fuente (leyenda)</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">title_font_size = 16.0; </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Tamaño de
fuente del título (leyenda)</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES" style="font-family: "courier new"; font-size: 10pt;">marker_size = 6; </span><span lang="ES" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Tamaño de los
marcadores</span><span lang="ES" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">color=[[1 0 0];[0 1 0];[0 0 1];[0 1 1];[1 0 1];[1 1 0]];</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% -------------------end graphic
configuration-----------------------------</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">num_div=100;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">figure(1)</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">clf;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">position = [1 2 width height];</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">set(gcf,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Units'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'centimeters'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Position'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,position,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'PaperUnits'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'centimeters'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'PaperPosition'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,position,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'PaperPositionMode'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'auto'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">% Crear ejes</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">axesposition = [margin_left, margin_bottom,
position(3)-margin_left-margin_right position(4)-margin_bottom-margin_top];</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">axes(</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'FontSize'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,font_size,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Units'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'centimeters'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'FontName'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,font_name,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Position'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,axesposition);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">hold </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">on</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">; grid </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">on</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">for</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> j=1:num_architectures</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> [counts,centers] =
hist(reshape(squeeze(angles_est(:,:,j)),[1,2*num_simu]),num_div);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> plot(centers,counts,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Color'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,color(j,:),</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'LineWidth'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,2);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> hold </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">on</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">end</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">aux=title(sprintf(</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Histogram
Estimation DOA (%i Simulations)\n(Source 1: %3.1f Source 2: %3.1f)\n(SNR %3.1f and %i
snapshots)'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> num_simu,angles(1),
angles(2),SNR,n),</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'interpreter'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'latex'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'HorizontalAlignment'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'center'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'FontSize'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,title_font_size);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">my_legend = names;</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">aux=legend(my_legend,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Interpreter'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'latex'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'FontSize'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,legend_font_size,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Orientation'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Vertical'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Units'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'centimeters'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Location'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'northwest'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">aux = xlabel(</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'$^\circ$ DOA'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">,</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Interpreter'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'latex'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'FontSize'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,font_size,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Units'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'centimeters'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;"> </span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'VerticalAlignment'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">,</span><span lang="EN-GB" style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'bottom'</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 10pt;">);</span><span lang="EN-GB" style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">set(aux,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Position'</span><span style="font-family: "courier new"; font-size: 10pt;">,get(aux,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Position'</span><span style="font-family: "courier new"; font-size: 10pt;">) - [0 .3 0])</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;">aux = ylabel(</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'N$^\circ$ of
simulations'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="color: forestgreen; font-family: "courier new"; font-size: 10.0pt;">,</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Interpreter'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'latex'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'FontSize'</span><span style="font-family: "courier new"; font-size: 10pt;">,font_size,</span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'Units'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'centimeters'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: blue; font-family: "courier new"; font-size: 10.0pt;">...</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "courier new"; font-size: 10pt;"> </span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'VerticalAlignment'</span><span style="font-family: "courier new"; font-size: 10pt;">,</span><span style="color: #a020f0; font-family: "courier new"; font-size: 10.0pt;">'bottom'</span><span style="font-family: "courier new"; font-size: 10pt;">);</span><span style="font-family: "courier new"; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="ES">(Nota: Corregir saltos de línea del código)<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span lang="EN-GB">Referencias: ESPRIT-Estimation of Signal Parameters Via Rotational
Invariance Techniques RICHARD ROY AND THOMAS KAILATH, FELLOWI, IEEE<o:p></o:p></span></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1693174021147070350.post-5466738936092074802016-06-04T13:00:00.001-07:002016-06-14T11:27:21.219-07:00Método de Jacobi de resolución de sistemas programado en C/C++<h2>
Método de Jacobi programado en C/C++ para la resolución de sistemas lineares de ecuaciones:</h2>
<div>
El método Jacobi es el método iterativo para resolver sistemas de ecuaciones lineales más simple y se aplica sólo a sistemas cuadrados, es decir a sistemas con tantas incógnitas como ecuaciones, del tipo:<br />
<div>
Ax=b<br />
<div>
<br />
Idea:<br />
1-Separar la matriz A en su diagonal (D) y en su matrices estrictamente superior (U) e inferior (L):<br />
A=D+L+U=D+R<br />
2-Reescribir el sistema con este desarrollo de la matriz A:<br />
b-(D+R)x=0<br />
b-Rx=Dx<br />
D^(-1)(b-Rx)=x<br />
3- A partir de esta ultima expresion se itera tomando un valor inicial de x denominado x0:<br />
D^(-1)(b-Rx(i))=x(i+1)<br />
donde x(i) hace referencia al valor de x en la iteración i.<br />
Hay que notar que la complejidad de calcular la inversa de la matriz diagonal es nula:<br />
D^(-1)(i,i)=1/D^(-1)(i,i)<br />
<div>
<br />
Nota: El método de Jacobi siempre converge si la matriz A es estrictamente diagonal dominante y puede converger incluso si esta condición no se satisface.</div>
</div>
</div>
</div>
<div>
<br />
Dejo aquí los enlaces a otros metodos de resolucion de sistemas programados en C y en PASCAL:<br />
<br />
JACOBI en PASCAL: http://cypascal.blogspot.fr/2012/03/resolucion-de-sistemas-mediante-jacobi.html<br />
GAUSS en C: http://cypascal.blogspot.fr/2012/10/metodo-de-gauss-en-cc.html<br />
GAUSS en PASCAL: http://cypascal.blogspot.fr/2012/10/metodo-de-gauss-en-cc.html<br />
LU en PASCAL:http://cypascal.blogspot.fr/2012/02/factorizacion-lu.html<br />
<br /></div>
<div>
Código:<br />
<br /></div>
<div>
<span style="font-family: monospace;">#include <stdio.h></span><br />
<span style="font-family: monospace;">#include <stdlib.h></span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">int dim;</span><br />
<span style="font-family: monospace;">float norma(float vector1[],float vector2[]);</span><br />
<span style="font-family: monospace;">float suma_jacobi(float Matriz[], float vector[], int componente);</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">int main(){</span><br />
<span style="font-family: monospace;"> int i,j,iteraciones=0;</span><br />
<span style="font-family: monospace;"> float error,epsilon;</span><br />
<span style="font-family: monospace;"> printf("\n METODO DE JACOBI DE RESOLUCION DE SISTEMAS Ax=b \n");</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> printf("Dimension de la matriz A: ");</span><br />
<span style="font-family: monospace;"> scanf("%d",&dim);</span><br />
<span style="font-family: monospace;"> float A[dim][dim],b[dim],x[dim],x_prev[dim],aux[dim];</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> printf("\n Elementos de la matriz A: \n");</span><br />
<span style="font-family: monospace;"> for(i=0;i<dim;i++) for(j=0;j<dim;j++){</span><br />
<span style="font-family: monospace;"> printf("A(%d,%d)=",i,j); scanf("%f",&A[i][j]);</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> printf("\n Elementos del vector b: \n");</span><br />
<span style="font-family: monospace;"> for(i=0;i<dim;i++){</span><br />
<span style="font-family: monospace;"> printf("b(%d)=",i); scanf("%f",&b[i]);</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> printf("\n Error de parada: \n");</span><br />
<span style="font-family: monospace;"> printf("E=",i); scanf("%f",&epsilon);</span><br />
<span style="font-family: monospace;"> error=epsilon+1;</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> //cominezo algoritmo de Jacobi</span><br />
<span style="font-family: monospace;"> //Error se mide como la norma del vector diferenceia entre la iteracion i e i+1</span><br />
<span style="font-family: monospace;"> printf("\n Valor inicail de la iteracion: \n");</span><br />
<span style="font-family: monospace;"> for(i=0;i<dim;i++){</span><br />
<span style="font-family: monospace;"> printf("x0(%d)=",i); scanf("%f",&x_prev[i]);</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> while (error>epsilon){</span><br />
<span style="font-family: monospace;"> for(i=0;i<dim;i++){</span><br />
<span style="font-family: monospace;"> for(j=0;j<dim;j++) aux[j]=A[i][j];</span><br />
<span style="font-family: monospace;"> x[i]=(1/A[i][i])*(b[i]-suma_jacobi(aux,x_prev,i));</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> error=norma(x,x_prev);</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> printf("\n\n Iteracion %d: \n",iteraciones);</span><br />
<span style="font-family: monospace;"> for(i=0;i<dim;i++){</span><br />
<span style="font-family: monospace;"> x_prev[i]=x[i];</span><br />
<span style="font-family: monospace;"> printf("X(%d)=%f \n",i,x[i]);</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> iteraciones++;</span><br />
<span style="font-family: monospace;"> if (iteraciones==10) error=epsilon-1;</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> printf("Solucion del sistema\n");</span><br />
<span style="font-family: monospace;"> printf("Numero de iteraciones: %d \n", iteraciones);</span><br />
<span style="font-family: monospace;"> for(i=0;i<dim;i++){</span><br />
<span style="font-family: monospace;"> printf("x(%d)=%f\n",i,x[i]);</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> return 1;</span><br />
<span style="font-family: monospace;">}</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">float norma(float vector1[],float vector2[]){</span><br />
<span style="font-family: monospace;"> float aux=0;</span><br />
<span style="font-family: monospace;"> int i;</span><br />
<span style="font-family: monospace;"> for(i=0;i<dim;i++){</span><br />
<span style="font-family: monospace;"> aux=aux+(vector1[i]-vector2[i])*(vector1[i]-vector2[i]);</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> return aux;</span><br />
<span style="font-family: monospace;">}</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">float suma_jacobi(float Matriz[], float vector[], int componente)</span><br />
<span style="font-family: monospace;">{</span><br />
<span style="font-family: monospace;"> float aux=0;</span><br />
<span style="font-family: monospace;"> int i;</span><br />
<span style="font-family: monospace;"> for(i=0;i<dim;i++){</span><br />
<span style="font-family: monospace;"> if (componente!=i){</span><br />
<span style="font-family: monospace;"> aux=aux+Matriz[i]*vector[i];</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> return aux;</span><br />
<span style="font-family: monospace;">}</span><br />
<br />
<br />
Salu10</div>
Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-1693174021147070350.post-43857778450868188602016-05-17T15:06:00.000-07:002016-05-20T08:45:26.769-07:00Método de agrupamiento K-Means en Lenguaje CEl siguiente programa escrito en C genera una segmentacion de un conjunto de vectores segun le metodo de las K-Means. <br />
Dada una familia de n vectores {v_1,v_2...v_n} el método de agrupamiento K-means permite agruparlos en un número k determinado de grupos {S_1,S_2...S_k}, de manera que se minimice la suma de los errores cuadraticos de cada vector respecto al punto medio de todos los vectores del mismo grupo al que pertenece.<br />
Este método es utilizado para la compresión de imágenes en tratamiento de señal, así como para la explotación de datos en lo que concierne al data mining y big data. Es un método bastante sencillo pero que consigue unos buenos resultados. Si necesitan más información sobre este método una búsqueda rápida les puede solucionar las dudas. Si es algo del código, encantado de ayudarles mediante un comentario en este post.<br />
<br />
El fichero de entrada que contiene los vectores a ordenar debe ser del tipo (por defecto este fichero se llama "datos.txt"):<br />
<br />
<span style="font-family: monospace;">0.5 -2 3 4</span><br />
<span style="font-family: monospace;">1 2.4 -1.2 0</span><br />
<span style="font-family: monospace;">1 2.9 4 2</span><br />
<span style="font-family: monospace;">0.1 0.002 -3.14 5</span><br />
<span style="font-family: monospace;">6.1 -5.1 -6.4 7</span><br />
<span style="font-family: monospace;">9.9 7 -2.4 3</span><br />
<span style="font-family: monospace;">-8 1 0.1 -3</span><br />
<span style="font-family: monospace;">0.03 -5 2.9 6</span><br />
<span style="font-family: monospace;"><br /></span>
Donde cada fila representa un vector (un total de ocho en este caso), y cada columna una componente de ese vector (4 en este caso).<br />
<br />
El fichero de salida que se obtiene es:<br />
<br />
<span style="font-family: monospace;"> </span><span style="font-family: monospace;"> SALIDA DEL METODO KMEANS</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">KMeans ha generado los siguientes grupos: </span><br />
<span style="font-family: monospace;">- Grupo 0 con media: [ -8.000000 1.000000 0.100000 -3.000000 ]</span><br />
<span style="font-family: monospace;">- Grupo 1 con media: [ 0.526000 -0.339600 1.112000 3.400000 ]</span><br />
<span style="font-family: monospace;">- Grupo 2 con media: [ 8.000000 0.950000 -4.400000 5.000000 ]</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">KMeans ha generado los siguientes grupos: </span><br />
<span style="font-family: monospace;">0.500000 -2.000000 3.000000 4.000000 1 </span><br />
<span style="font-family: monospace;">1.000000 2.400000 -1.200000 0.000000 1 </span><br />
<span style="font-family: monospace;">1.000000 2.900000 4.000000 2.000000 1 </span><br />
<span style="font-family: monospace;">0.100000 0.002000 -3.140000 5.000000 1 </span><br />
<span style="font-family: monospace;">6.100000 -5.100000 -6.400000 7.000000 2 </span><br />
<span style="font-family: monospace;">9.900000 7.000000 -2.400000 3.000000 2 </span><br />
<span style="font-family: monospace;">-8.000000 1.000000 0.100000 -3.000000 0 </span><br />
<span style="font-family: monospace;">0.030000 -5.000000 2.900000 6.000000 1 </span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> Error: 8.097519 </span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> Reparticion grupos: </span><br />
<span style="font-family: monospace;">Grupo 0 : 1 elementos. </span><br />
<span style="font-family: monospace;">Grupo 1 : 5 elementos. </span><br />
<span style="font-family: monospace;">Grupo 2 : 2 elementos. </span><br />
<div>
<br /></div>
<br />
El código escrito en C está suficientemente comentado por lo que no debería suponer ningún problema:<br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"><br /></span><br />
<span style="font-family: monospace;">/*Metodo k-means de agrupamiento CYPASCAL.BLOGSPOT.COM*/</span><br />
<span style="font-family: monospace;">/*NOTAS IMPORTANTES:</span><br />
<span style="font-family: monospace;"> - Variables principales:</span><br />
<span style="font-family: monospace;"> Comp: Numero de componenetes que tiene cada vector. Dimensón del espacio vectorial Rn al que</span><br />
<span style="font-family: monospace;"> pertenecen.</span><br />
<span style="font-family: monospace;"> Grup: Numero de conjuntos en los que se van a agrupar los vectores.</span><br />
<span style="font-family: monospace;"> Epsilon: Si la diferencia entre el error cometido en la iteración anterior y el error cometido</span><br />
<span style="font-family: monospace;"> en la iteración actual es menor que este valor, se sale del algoritmo.</span><br />
<span style="font-family: monospace;"> - En el fichero de entrada cada vector aparece en una linea, y cada componente separada por un espacio.</span><br />
<span style="font-family: monospace;"> A modo de ejemplo, si el numero de componentes es 3, y el numero de vectores a ordenar es 5, un fichero</span><br />
<span style="font-family: monospace;"> tipo podría ser:</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> 0.25 21.2 -1.25</span><br />
<span style="font-family: monospace;"> 14.3 -1.2 5</span><br />
<span style="font-family: monospace;"> -0.001 10 0</span><br />
<span style="font-family: monospace;"> 0 -1.5 4</span><br />
<span style="font-family: monospace;"> 1 2 7</span><br />
<span style="font-family: monospace;">*/</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">#include <stdio.h></span><br />
<span style="font-family: monospace;">#include <stdlib.h></span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">FILE *Lectura, *Escritura;</span><br />
<span style="font-family: monospace;">int Comp,Vect,Grup;</span><br />
<span style="font-family: monospace;">float Epsilon;</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">float Norma(float Vect1[], float Vect2[]);</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">int main(void)</span><br />
<span style="font-family: monospace;">{</span><br />
<span style="font-family: monospace;"> /* 1: Pedimos los datos necesarios */</span><br />
<span style="font-family: monospace;"> srand(time(NULL));</span><br />
<span style="font-family: monospace;"> printf("METODO K-MEANS (Agrupamiento de vectores minimizando el ECM) \n");</span><br />
<span style="font-family: monospace;"> printf("Numero de componentes del vector: ");</span><br />
<span style="font-family: monospace;"> scanf("%i", &Comp);</span><br />
<span style="font-family: monospace;"> printf("Numero de vectores a ordenar: ");</span><br />
<span style="font-family: monospace;"> scanf("%i", &Vect);</span><br />
<span style="font-family: monospace;"> printf("Numero de conjuntos en los que agrupar los vectores: ");</span><br />
<span style="font-family: monospace;"> scanf("%i", &Grup);</span><br />
<span style="font-family: monospace;"> printf("Limite de convergencia: ");</span><br />
<span style="font-family: monospace;"> scanf("%f", &Epsilon);</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> int aVect=0,aComp=0,i,j,minG;</span><br />
<span style="font-family: monospace;"> float Tabla[Vect][Comp];</span><br />
<span style="font-family: monospace;"> float min,aux,ErrorAct,ErrorAnt=0,dif;</span><br />
<span style="font-family: monospace;"> float MediaGrup[Grup][Comp],maxi[Comp],mini[Comp];</span><br />
<span style="font-family: monospace;"> for (i=0; i<Comp; i++){maxi[i]=0; mini[i]=0;}</span><br />
<span style="font-family: monospace;"> int CompGrup[Vect]; //Grupo en el que se encuentra el vector</span><br />
<span style="font-family: monospace;"> int NumCompGrup[Grup]; //Numero de componentes en cada grupo</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> /* 2: Leemos el fichero de lectura y cargamos los datos en la tabla para un acceso más rápido*/</span><br />
<span style="font-family: monospace;"> Lectura=fopen("datos.txt","r");</span><br />
<span style="font-family: monospace;"> if (Lectura) {</span><br />
<span style="font-family: monospace;"> for (i=0; i<Vect; i++) for (j=0; j<Comp; j++) {{</span><br />
<span style="font-family: monospace;"> fscanf(Lectura,"%f",&Tabla[i][j]);</span><br />
<span style="font-family: monospace;"> if (mini[j] > Tabla[i][j]) mini[j] = Tabla[i][j];</span><br />
<span style="font-family: monospace;"> if (maxi[j] < Tabla[i][j]) maxi[j] = Tabla[i][j];</span><br />
<span style="font-family: monospace;"> if (Tabla[i][j]==EOF){</span><br />
<span style="font-family: monospace;"> i=Vect;</span><br />
<span style="font-family: monospace;"> j=Comp;}</span><br />
<span style="font-family: monospace;"> printf("%f \n",Tabla[i][j]);</span><br />
<span style="font-family: monospace;"> }}</span><br />
<span style="font-family: monospace;"> fclose(Lectura);</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> /* 3: Inicializamos el vector de medias con valores aleatorios*/</span><br />
<span style="font-family: monospace;"> for (i=0; i<Grup; i++) for (j=0; j<Comp; j++) {</span><br />
<span style="font-family: monospace;"> MediaGrup[i][j]=(float)rand()/RAND_MAX*(maxi[j]-mini[j])+mini[j];</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> dif=Epsilon+1; //Para entrar en el bucle</span><br />
<span style="font-family: monospace;"> /* 4: Bucle principal del que no se sale hasta ser inferior a epsilon*/</span><br />
<span style="font-family: monospace;"> while (dif>Epsilon){</span><br />
<span style="font-family: monospace;"> ErrorAct=0;</span><br />
<span style="font-family: monospace;"> /* 4.1: Se mira a que grupo pertenece cada vector*/</span><br />
<span style="font-family: monospace;"> for (i=0; i<Vect; i++){</span><br />
<span style="font-family: monospace;"> min = Norma(Tabla[i],MediaGrup[0]);</span><br />
<span style="font-family: monospace;"> minG=0;</span><br />
<span style="font-family: monospace;"> for (j=1; j<Grup; j++){</span><br />
<span style="font-family: monospace;"> aux=Norma(Tabla[i],MediaGrup[j]);</span><br />
<span style="font-family: monospace;"> if (aux<min){min=aux; minG=j;}</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> CompGrup[i]=minG;</span><br />
<span style="font-family: monospace;"> ErrorAct=ErrorAct+min;</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> /* 4.2: Se actualiza el valor de la media del grupo*/</span><br />
<span style="font-family: monospace;"> for (i=0; i<Grup; i++){</span><br />
<span style="font-family: monospace;"> for (j=0; j<Comp; j++){</span><br />
<span style="font-family: monospace;"> MediaGrup[i][j]=0;</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> NumCompGrup[i]=0;</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> for (i=0; i<Vect; i++){</span><br />
<span style="font-family: monospace;"> for (j=0; j<Comp; j++){</span><br />
<span style="font-family: monospace;"> MediaGrup[CompGrup[i]][j]=MediaGrup[CompGrup[i]][j]+Tabla[i][j];</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> NumCompGrup[CompGrup[i]]++;</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> for (i=0; i<Grup; i++){</span><br />
<span style="font-family: monospace;"> for (j=0; j<Comp; j++){</span><br />
<span style="font-family: monospace;"> MediaGrup[i][j]=MediaGrup[i][j]/NumCompGrup[i];</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> dif=abs(ErrorAct-ErrorAnt);</span><br />
<span style="font-family: monospace;"> ErrorAnt=ErrorAct;</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> /* 5: Escritura de los resultados finales*/</span><br />
<span style="font-family: monospace;"> Escritura=fopen("SalidaKMEANS.txt","w");</span><br />
<span style="font-family: monospace;"> fprintf(Escritura, "\n SALIDA DEL METODO KMEANS\n\n");</span><br />
<span style="font-family: monospace;"> fprintf(Escritura, "KMeans ha generado los siguientes grupos: \n");</span><br />
<span style="font-family: monospace;"> for (i=0; i<Grup; i++){</span><br />
<span style="font-family: monospace;"> fprintf(Escritura, "- Grupo %i con media: [",i);</span><br />
<span style="font-family: monospace;"> for (j=0; j<Comp; j++) fprintf(Escritura, " %f ",MediaGrup[i][j]);</span><br />
<span style="font-family: monospace;"> fprintf(Escritura, "]\n");</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> fprintf(Escritura, "\n\nKMeans ha generado los siguientes grupos: \n");</span><br />
<span style="font-family: monospace;"> for (i=0; i<Vect; i++){</span><br />
<span style="font-family: monospace;"> for (j=0; j<Comp; j++){</span><br />
<span style="font-family: monospace;"> fprintf(Escritura, "%f ", Tabla[i][j]);</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> fprintf(Escritura, "%i \n", CompGrup[i]);</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> fprintf(Escritura, "\n Error: %f \n", ErrorAct);</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> fprintf(Escritura, "\n Reparticion grupos: \n");</span><br />
<span style="font-family: monospace;"> for (i=0; i<Grup; i++){</span><br />
<span style="font-family: monospace;"> fprintf(Escritura, "Grupo %i : %i elementos. \n", i,NumCompGrup[i]);</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> fclose(Escritura);</span><br />
<span style="font-family: monospace;"> return 0;</span><br />
<span style="font-family: monospace;">}</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">float Norma(float Vect1[], float Vect2[])</span><br />
<span style="font-family: monospace;">{</span><br />
<span style="font-family: monospace;"> float aux=0;</span><br />
<span style="font-family: monospace;"> int n,j;</span><br />
<span style="font-family: monospace;"> n = (int) sizeof(Vect1)/sizeof(Vect1[0]);</span><br />
<span style="font-family: monospace;"> for (j=0; j<n; j++) {</span><br />
<span style="font-family: monospace;"> aux=aux+(Vect1[j]-Vect2[j])*(Vect1[j]-Vect2[j]);</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> return aux;</span><br />
<span style="font-family: monospace;">}</span><br />
<div>
<br /></div>
<div>
<br /></div>
<div>
Salu10.</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1693174021147070350.post-14780880586835616912016-02-12T11:24:00.000-08:002016-02-12T11:26:01.404-08:00Distribución uniforme en C/C++El siguiente programa genera una ristra valores que siguen una distribución uniforme de media y desviación típica elegidas por el usuario. En otras entradas se muestra como apartir de este programa, generar otros tipos de distribuciones distintas a la uniforme (<a href="http://cypascal.blogspot.fr/2016/02/crear-una-distribucion-normal-en-c.html">Ver aquí</a>). Los valores de salida se guardan en un fichero de texto. El código es el siguiente:<br />
<br />
<span style="font-family: monospace;">/*programa que genera una serie de numeros aleatorios</span><br />
<span style="font-family: monospace;">que siguen una distribución uniforme, pidiendo al usuario</span><br />
<span style="font-family: monospace;">el número de datos, y los registra en un fichero .txt*/</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">#include <stdio .h=""></span><br />
<span style="font-family: monospace;">#include <stdlib .h=""></span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">FILE *archivo;</span><br />
<span style="font-family: monospace;">int i,dat;</span><br />
<span style="font-family: monospace;">float num, mini, maxi;</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">int main(void)</span><br />
<span style="font-family: monospace;">{</span><br />
<span style="font-family: monospace;"> /*creamos el archivo de texto*/</span><br />
<span style="font-family: monospace;"> archivo=fopen("prueba.txt","w");</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> printf("GENERADOR DISTRIBUCION UNIFORME \n");</span><br />
<span style="font-family: monospace;"> printf("Seleccione valor minimo de la distribucion: ");</span><br />
<span style="font-family: monospace;"> scanf("%f", &amp;mini);</span><br />
<span style="font-family: monospace;"> printf("Seleccione valor maximo de la distribucion: ");</span><br />
<span style="font-family: monospace;"> scanf("%f", &amp;maxi);</span><br />
<span style="font-family: monospace;"> printf("Seleccione el numero de datos a crear: ");</span><br />
<span style="font-family: monospace;"> scanf("%i", &amp;dat);</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> /*reiniciamos la semilla de generacion de numeros</span><br />
<span style="font-family: monospace;"> aleatorios (srand48 para generar numeros decimales)*/</span><br />
<span style="font-family: monospace;"> //srand(time(NULL));</span><br />
<span style="font-family: monospace;"> for (i=1; i&lt;=dat; i++)</span><br />
<span style="font-family: monospace;"> {</span><br />
<span style="font-family: monospace;"> /*(rand()/RAND_MAX) nos devuelve un numero</span><br />
<span style="font-family: monospace;"> aleatorio con distribucion uniforme entre 0 y 1.</span><br />
<span style="font-family: monospace;"> Se hace un cast para pasar el numero que esta en</span><br />
<span style="font-family: monospace;"> formato entero a formato coma flotante, para que</span><br />
<span style="font-family: monospace;"> la division no sea entre eneteros*/</span><br />
<span style="font-family: monospace;"> num=(float)rand()/RAND_MAX*(maxi-mini)+mini;</span><br />
<span style="font-family: monospace;"> fprintf(archivo, "%f \n", num);</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> fclose (archivo);</span><br />
<span style="font-family: monospace;"> return 0;</span><br />
<span style="font-family: monospace;">}</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">Salu10</span>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-1693174021147070350.post-28982574371186394212016-02-12T11:18:00.000-08:002016-02-12T11:26:48.312-08:00Crear una distribución normal en CEn el siguiente programa vamos a estudiar la generación de distribuciones de probabilidad distintas a la uniforme, haciendo uso del comando rand de C. (Aquí la <a href="http://cypascal.blogspot.fr/2016/02/distribucion-uniforme-en-cc.html">publicación</a> donde se muestra como hacerlo)<br />
C nos permite generar variables aleatorias, sin embargo, estas siguen unicamente una ley de distribución unifrme. Sin embargo, podemos obtener cualquier otro tipo de distribución, por ejemplo la normal, que es la más ampliamente utilizada, ya que está presente en gran cantidad de fenómenos naturales.<br />
Partiendo del Teorema del limite central, el cual dice:<br />
<br />
<i> "la distribución de probabilidad de la suma de N valores de variables aleatorias Xi independiente pero idénticamente distribuidos, con medias respectivas Ei y variancias sigma^2i, se aproxima asintóticamente a una distribución normal, a medida que N se hace muy grande, y que dicha distribución tiene como media y varianzas respectivamente, a:</i><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTW3lOvw5rxFyR0niytMX9iXEDkXjIxB2UKj_QSTN75YYqy4OzaOdad_QSI_gYrWGZtLqlV-3DuJBn2wvTX3SGF2GwLuM5BGOQIHZdNYfOvMSEOkVgkn6IJStcllsgmE6UFWiCtKwzhrA/s1600/Captura.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTW3lOvw5rxFyR0niytMX9iXEDkXjIxB2UKj_QSTN75YYqy4OzaOdad_QSI_gYrWGZtLqlV-3DuJBn2wvTX3SGF2GwLuM5BGOQIHZdNYfOvMSEOkVgkn6IJStcllsgmE6UFWiCtKwzhrA/s200/Captura.PNG" width="140" /></a></div>
<i><br /></i>
<i>"</i><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvOqIWMCfzzMiyqjrxOUEqgmoK_B6Xz-AVnfD59r086NN4PvOwOGt6qxwrsQs7HgMJ5bN0Ifwii-VkAM9fLkwnHn-PqTWvmZV87l9GbI_0kjxewq4x2wUoQBOU_3DP3Ywsoi27NVav3_U/s1600/Captura.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="347" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvOqIWMCfzzMiyqjrxOUEqgmoK_B6Xz-AVnfD59r086NN4PvOwOGt6qxwrsQs7HgMJ5bN0Ifwii-VkAM9fLkwnHn-PqTWvmZV87l9GbI_0kjxewq4x2wUoQBOU_3DP3Ywsoi27NVav3_U/s640/Captura.PNG" width="640" /></a></div>
<span style="font-size: x-small;">(Fuente: "Generación de valores de las variables aleatorias", Juan F. Olivares-Pacheco)</span><br />
<div>
<br />
Para obtener una distribución normal normalizada (es decir, de media 0 y desviación típica 1) a partir de una uniforme podemos proceder del modo siguiente:<br />
-1) Generamos N muestras de una señal uniforme, con valores distribuidos entre -0.5 y 0.5, es decir, con p(x)=1, y una esperanza nula.<br />
-2) Creamos una nueva varible aleatoria, sumando todas las muestras. Esta nueva varaible aleatoria sigue una distribución normal, para grandes valores de N.<br />
-3) Realizamos estos dos pasos M veces, de modo que podamos verificar que efectivamente se sigue una distribución normal.<br />
<br />
El código siguiente, genera una ristra de números que siguen una distribución de media y desviación típica elegidas por el usuario. Los datos se guardan en un fichero de texto.<br />
<br />
<span style="font-family: monospace;">/*programa que genera una serie de numeros aleatorios</span><br />
<span style="font-family: monospace;">que siguen una distribución normal, pidiendo al usuario</span><br />
<span style="font-family: monospace;">el número de datos, la varianza y la media de la distribucion,</span><br />
<span style="font-family: monospace;"> y los registra en un fichero .txt*/</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">#include <stdio.h></span><br />
<span style="font-family: monospace;">#include <stdlib.h></span><br />
<span style="font-family: monospace;">#include <math.h></span><br />
<span style="font-family: monospace;">/*cK define el numero de datos que se suman para obtener</span><br />
<span style="font-family: monospace;">la distribucion normal. Referirse al paper de generacion de</span><br />
<span style="font-family: monospace;">variables aleatorias. Carpeta traitement numerique de signal*/</span><br />
<span style="font-family: monospace;">#define cK 1000</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">FILE *archivo;</span><br />
<span style="font-family: monospace;">int i,k,dat;</span><br />
<span style="font-family: monospace;">float num, media, var, desv, aux;</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;">int main(void)</span><br />
<span style="font-family: monospace;">{</span><br />
<span style="font-family: monospace;"> /*creamos el archivo de texto*/</span><br />
<span style="font-family: monospace;"> archivo=fopen("prueba.txt","w");</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> printf("GENERADOR DISTRIBUCION UNIFORME \n");</span><br />
<span style="font-family: monospace;"> printf("Seleccione la media de la distribucion: ");</span><br />
<span style="font-family: monospace;"> scanf("%f", &media);</span><br />
<span style="font-family: monospace;"> printf("Seleccione la varianza de la distribucion: ");</span><br />
<span style="font-family: monospace;"> scanf("%f", &var);</span><br />
<span style="font-family: monospace;"> printf("Seleccione el numero de datos a crear: ");</span><br />
<span style="font-family: monospace;"> scanf("%i", &dat);</span><br />
<span style="font-family: monospace;"><br /></span>
<span style="font-family: monospace;"> desv=sqrt(var);</span><br />
<span style="font-family: monospace;"> /*reiniciamos la semilla de generacion de numeros</span><br />
<span style="font-family: monospace;"> aleatorios (srand48 para generar numeros decimales)*/</span><br />
<span style="font-family: monospace;"> srand(time(NULL));</span><br />
<span style="font-family: monospace;"> for (i=1; i<=dat; i++){</span><br />
<span style="font-family: monospace;"> aux=0;</span><br />
<span style="font-family: monospace;"> for (k=1;k<=cK;k++){</span><br />
<span style="font-family: monospace;"> aux=aux+(float)rand()/RAND_MAX;</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> num=desv*sqrt((float)12/cK)*(aux-(float)cK/2)+media;</span><br />
<span style="font-family: monospace;"> fprintf(archivo, "%f \n", num);</span><br />
<span style="font-family: monospace;"> }</span><br />
<span style="font-family: monospace;"> fclose (archivo);</span><br />
<span style="font-family: monospace;"> return 0;</span><br />
<span style="font-family: monospace;">}</span></div>
<div>
<br /></div>
<div>
Salu10</div>
Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-1693174021147070350.post-1834888133813412542015-03-16T05:01:00.003-07:002015-06-05T05:16:56.817-07:00Método ROC de ordenación de células de fabricaciónSiguiendo con la entrada dedicada al método PFA de ordenación de células en un proceso productivo, que podéis visitar aquí: <a href="http://cypascal.blogspot.com.es/2015/03/metodo-pfa-para-celulas-de-fabriacion.html">http://cypascal.blogspot.com.es/2015/03/metodo-pfa-para-celulas-de-fabriacion.html</a><br />
Publicamos ahora una nueva entrada dedicada a un método cuyo objetivo es el mismo, pero con un procedimiento diferente. La programación también se realiza en MatLab. El método se denomina ROC (<i>Rank Order Clustering</i>)<br />
Lo que se persigue es diagonalizar la matriz pero din duplicar las máquinas que participan en el proceso. Por lo que en la distribución que se obtenga finalmente, solo habra una máquina de cada tipo. Será trabajo vuestro el decidir que máquinas duplicar para mejorar la distribución.<br />
Este algoritmo de ordenación de células de manufactura es mucho más sencillo que el PFA. Simplemente hay que tomar las filas y columnas de 1 y 0, como si fueran números binarios, y ordenar filas y columnas, de mayor a menor, de derecha a izquierda y de arriba a abajo.<br />
<br />
El algoritmo escrito en MatLab es el siguiente;<br />
<br />
<i>M=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43;</i><br />
<i> 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0;</i><br />
<i> 2 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 1 0 1 0;</i><br />
<i> 3 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0;</i><br />
<i> 4 0 0 0 0 1 0 0 1 1 0 0 0 0 1 0 0 0 0 1 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0;</i><br />
<i> 5 0 0 0 0 1 0 0 1 1 0 0 0 0 1 1 1 0 0 1 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 1;</i><br />
<i> 6 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 1 1 0 1 1;</i><br />
<i> 7 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;</i><br />
<i> 8 1 1 1 0 0 0 0 1 1 0 1 1 0 0 1 0 0 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 0 0 0 0 1 1 0 0 1 0 1;</i><br />
<i> 9 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 1 0 1 0;</i><br />
<i> 10 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0;</i><br />
<i> 11 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0;</i><br />
<i> 12 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0;</i><br />
<i> 13 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 1 0;</i><br />
<i> 14 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;</i><br />
<i> 15 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0;</i><br />
<i> 16 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1;</i><br />
<i> ];</i><br />
<i><br /></i>
<i>fil = 16+1;</i><br />
<i>col = 43+1;</i><br />
<i>cambios = 1;</i><br />
<i><br /></i>
<i> while cambios</i><br />
<i> cambios = 0;</i><br />
<i> AuxFil=zeros(fil,1);</i><br />
<i> AuxCol=zeros(col,1);</i><br />
<i> %Calcula valores Filas</i><br />
<i> for i = 2:fil</i><br />
<i> AuxFil(i)=0;</i><br />
<i> for j = 2:col</i><br />
<i> AuxFil(i)=AuxFil(i)+M(i,j)*2^(col+1-j);</i><br />
<i> end</i><br />
<i> end</i><br />
<i> %Ordena Filas</i><br />
<i> max(1)=0;</i><br />
<i> max(2)=0;</i><br />
<i> for i = 2:fil</i><br />
<i> %Se calcula el máximo</i><br />
<i> for j = i:fil</i><br />
<i> if AuxFil(j)>max(1)</i><br />
<i> max(1)=AuxFil(j);</i><br />
<i> max(2)=j;</i><br />
<i> end</i><br />
<i> end</i><br />
<i> %Se intercambia posición</i><br />
<i> if max(2) ~= i</i><br />
<i> cambios = 1;</i><br />
<i> for j = 1:col</i><br />
<i> aux=M(i,j);</i><br />
<i> M(i,j)=M(max(2),j);</i><br />
<i> M(max(2),j)=aux;</i><br />
<i> end</i><br />
<i> end</i><br />
<i> max(1)=0;</i><br />
<i> max(2)=0;</i><br />
<i> end</i><br />
<i> </i><br />
<i> %Calcula valores Columnas</i><br />
<i> for j = 2:col</i><br />
<i> AuxCol(j)=0;</i><br />
<i> for i = 2:fil</i><br />
<i> AuxCol(j)=AuxCol(j)+M(i,j)*2^(fil+1-i);</i><br />
<i> end</i><br />
<i> end</i><br />
<i> %Ordena Columnas</i><br />
<i> max(1)=0;</i><br />
<i> max(2)=0;</i><br />
<i> for j = 2:col</i><br />
<i> %Se calcula el máximo</i><br />
<i> for i = j:col</i><br />
<i> if AuxCol(i)>max(1)</i><br />
<i> max(1)=AuxCol(i);</i><br />
<i> max(2)=i;</i><br />
<i> end</i><br />
<i> end</i><br />
<i> %Se intercambia posición</i><br />
<i> if max(2) ~= j</i><br />
<i> cambios = 1;</i><br />
<i> for i = 1:fil</i><br />
<i> aux=M(i,j);</i><br />
<i> M(i,j)=M(i,max(2));</i><br />
<i> M(i,max(2))=aux;</i><br />
<i> end</i><br />
<i> end</i><br />
<i> max(1)=0;</i><br />
<i> max(2)=0;</i><br />
<i> end</i><br />
<i> end</i><br />
<i><br /></i>
<i><br /></i>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1693174021147070350.post-46916942652085178692015-03-16T04:52:00.000-07:002015-03-16T05:06:04.465-07:00Método PFA para células de fabriaciónEl método/algoritmo PFA (<i>Production Flow Analysis</i>) es utilizado a la hora de ordenar las diferentes máquinas que actúan en un proceso de manufactura, y que son necesarias para fabricar un conjunto de piezas.<br />
Este algoritmo (Disponible aquí en <i>MatLab</i>) nos permite calcular cual es el número de máquinas de cada uno de los tipos, así como el cómo agruparlas para poder obtener una distribución eficiente. Este algoritmo nos da como salida un número de células (<i>manufacturing cells</i>), formadas con las distintas máquinas, y en las que se producen unos tipos de pieza. Este algoritmo se basa en ir diagnoalizando la matriz del proceso mediante la agrupación en células y duplicación de máquinas. Se puede encontrar más inforamción sobre el método en:<br />
- <a href="https://books.google.es/books?id=lmLv68XlCZUC&pg=PA614&lpg=PA614&dq=PFA+manufacturing+cells&source=bl&ots=Ak-1st4wOa&sig=iDFJSbleW5opWKQVQS0h4yMzxiA&hl=es&sa=X&ei=kL8GVanwD8SBUdbegPAP&ved=0CFIQ6AEwBg#v=onepage&q=PFA%20manufacturing%20cells&f=false">Handbook of cellular manufacturing</a><br />
<a href="http://opencourses.emu.edu.tr/pluginfile.php/4532/course/section/888/CIM%20Lecture%20Notes%206.pdf">- Curso abierto Universidad de Chipre</a> (Muy completo)<br />
<br />
Otro tipo de ordenación de células es el <i>ROC</i>, que lo podéis encontrar también aquí: <a href="http://cypascal.blogspot.com.es/2015/03/metodo-roc-de-ordenacion-de-celulas-de.html">Método ROC</a><br />
El código ha sido implementado en <i>MatLab</i>. La matriz del ejemplo es la de un proceso productivo donde se quieren fabricar 43 tipos de piezas con 16 tipos de máquinas.<br />
<br />
El código en <i>MatLab</i>:<br />
<br />
<br />
<i>M=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0;</i><br />
<i> 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 1 0 1 0;</i><br />
<i> 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0;</i><br />
<i> 0 0 0 0 1 0 0 1 1 0 0 0 0 1 0 0 0 0 1 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0;</i><br />
<i> 0 0 0 0 1 0 0 1 1 0 0 0 0 1 1 1 0 0 1 0 1 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 1;</i><br />
<i> 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 1 1 0 1 1;</i><br />
<i> 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;</i><br />
<i> 1 1 1 0 0 0 0 1 1 0 1 1 0 0 1 0 0 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 0 0 0 0 1 1 0 0 1 0 1;</i><br />
<i> 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 1 0 1 0;</i><br />
<i> 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0;</i><br />
<i> 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0;</i><br />
<i> 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0;</i><br />
<i> 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 1 0;</i><br />
<i> 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;</i><br />
<i> 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0;</i><br />
<i> 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1;</i><br />
<i> ];</i><br />
<i><br /></i>
<i>fil = 16;</i><br />
<i>col = 43;</i><br />
<i>filC = 1;</i><br />
<i>colC = 1;</i><br />
<i>piezas = 0;</i><br />
<i>nummaq = 0;</i><br />
<i>%matriz de celulas</i><br />
<i>cel=zeros(300,col);</i><br />
<i><br /></i>
<i><br /></i>
<i>for iteracione = 1:16</i><br />
<i>%Calculamos piezas por máquina</i><br />
<i>for i = 1:fil</i><br />
<i> suma(i)=0;</i><br />
<i> for j = 1:col</i><br />
<i> if M(i,j) == 1</i><br />
<i> suma(i)=suma(i)+1;</i><br />
<i> end</i><br />
<i> end</i><br />
<i>end</i><br />
<br />
<i>%Calcular minimo de piezas por máquina</i><br />
<i>min =100;</i><br />
<i>for i = 1:fil</i><br />
<i> if ((suma(i) < min) && (suma(i) ~= 0))</i><br />
<i> min=suma(i);</i><br />
<i> end</i><br />
<i>end</i><br />
<i> </i><br />
<i>%Miramos filas con minimo</i><br />
<i>maqmin=0;</i><br />
<i>for i = 1:fil</i><br />
<i> if suma(i) == min</i><br />
<i> maqmin=i;</i><br />
<i> break</i><br />
<i> end</i><br />
<i>end</i><br />
<i><br /></i>
<i>aux2=zeros(1,10);</i><br />
<i>cont1=0;</i><br />
<i>for j = 1:col</i><br />
<i> if M(maqmin,j) == 1</i><br />
<i> cont1=cont1+1;</i><br />
<i> %aux2(cont1)=j=tipo pieza fabricada en maquina maqmin</i><br />
<i> aux2(cont1)=j;</i><br />
<i> end</i><br />
<i>end</i><br />
<i><br /></i>
<i>for i = 1:fil</i><br />
<i> aux3=0;</i><br />
<i> for a = 1:cont1</i><br />
<i> h=aux2(a);</i><br />
<i> aux3 = aux3 + M(i,h);</i><br />
<i> cel(1,1+a+piezas)=aux2(a);</i><br />
<i> end</i><br />
<i><br /></i>
<i> if (aux3>0)</i><br />
<i> nummaq=nummaq+1;</i><br />
<i> cel(nummaq+1,1)=i;</i><br />
<i> for a = 1:cont1</i><br />
<i> cel(nummaq+1,1+a+piezas)= M(i,aux2(a));</i><br />
<i> end</i><br />
<i> end</i><br />
<i>end</i><br />
<i><br /></i>
<i>piezas = piezas+cont1;</i><br />
<i><br /></i>
<i>for i=1:fil</i><br />
<i> for a = 1:cont1</i><br />
<i> M(i,aux2(a))=0;</i><br />
<i> end</i><br />
<i>end</i><br />
<i>end</i><br />
<br />
<br />
Un saludo y espero que les haya servido de ayuda.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1693174021147070350.post-70001898352111685682014-11-10T09:25:00.001-08:002014-12-20T07:45:11.166-08:00Calcula multiplicación de dos matrices en C/C++ (Arrays)El siguiente programa calcula el producto de dos matrices (arrays bidimensionales), también conocido como producto matricial, en lenguaje de programación C. El programa comprueba que las matrices tienen las dimensiones adecuadas para llevar a cabo el producto de ambas dos. Como programa relacionado coloco el cálculo de la suma de dos matrices:<br />
http://cypascal.blogspot.com.es/2012/07/suma-de-matrices-en-c-arrays.html<br />
<br />
Este programa es útil para ver como funcionan los arrays en C.<br />
<br />
Aquí les dejo el código del programa multiplicador de matrices:<br />
<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">#include <stdio.h></span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">int const Tam=101;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">void PideDatos(int Dim[][3], float Mat1[][Tam], float Mat2[][Tam]);</span><br />
<span style="font-family: Courier New, Courier, monospace;">void EscribeDatos(int Dim[][3], float Mat[][Tam], int au);</span><br />
<span style="font-family: Courier New, Courier, monospace;">void Mult(int Dim[][3], float Mat1[][Tam], float Mat2[][Tam], float Mat3[][Tam]);</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">int main(void)</span><br />
<span style="font-family: Courier New, Courier, monospace;">{</span><br />
<span style="font-family: Courier New, Courier, monospace;"> int C, Dimension[4][3];</span><br />
<span style="font-family: Courier New, Courier, monospace;"> float Matriz1[Tam][Tam], Matriz2[Tam][Tam], Matriz3[Tam][Tam];</span><br />
<span style="font-family: Courier New, Courier, monospace;"> PideDatos(Dimension,Matriz1,Matriz2);</span><br />
<span style="font-family: Courier New, Courier, monospace;"> printf("\nCalcula MULTIPLICACION: \n\n");</span><br />
<span style="font-family: Courier New, Courier, monospace;"> EscribeDatos(Dimension,Matriz1,1);</span><br />
<span style="font-family: Courier New, Courier, monospace;"> EscribeDatos(Dimension,Matriz2,2);</span><br />
<span style="font-family: Courier New, Courier, monospace;"> Mult(Dimension,Matriz1,Matriz2,Matriz3);</span><br />
<span style="font-family: Courier New, Courier, monospace;"> printf("\n\n\nLa matriz resultante es: \n");</span><br />
<span style="font-family: Courier New, Courier, monospace;"> EscribeDatos(Dimension,Matriz3,3);</span><br />
<span style="font-family: Courier New, Courier, monospace;"> scanf("%d");</span><br />
<span style="font-family: Courier New, Courier, monospace;"> return(0);</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">void PideDatos(int Dim[][3], float Mat1[][Tam], float Mat2[][Tam])</span><br />
<span style="font-family: Courier New, Courier, monospace;">{</span><br />
<span style="font-family: Courier New, Courier, monospace;"> int A,B,i;</span><br />
<span style="font-family: Courier New, Courier, monospace;"> printf("\n\n ||CALCULA EL PRODUCTO DE MATRICES M1*M2||");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> //Matriz 1</span><br />
<span style="font-family: Courier New, Courier, monospace;"> printf("\n\n\n Introduce el numero de filas de la matriz 1:");</span><br />
<span style="font-family: Courier New, Courier, monospace;"> scanf("%d", &Dim[1][1]);</span><br />
<span style="font-family: Courier New, Courier, monospace;"> printf("\n\n\n Introduce el numero de columnas de la matriz 1:");</span><br />
<span style="font-family: Courier New, Courier, monospace;"> scanf("%d", &Dim[1][2]);</span><br />
<span style="font-family: Courier New, Courier, monospace;"> printf("\n\n INTRODUCIR CADA COMPONENTE DE LA MATRIZ 1:");</span><br />
<span style="font-family: Courier New, Courier, monospace;"> for(A=1;A<= Dim[1][1];A++) for(B=1;B<= Dim[1][2];B++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n Termino M1(%d,%d):",A,B); scanf("%f",&Mat1[A][B]);}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> //Matriz 2</span><br />
<span style="font-family: Courier New, Courier, monospace;"> printf("\n\n\n Introduce el numero de filas de la matriz 2:");</span><br />
<span style="font-family: Courier New, Courier, monospace;"> scanf("%d", &Dim[2][1]);</span><br />
<span style="font-family: Courier New, Courier, monospace;"> printf("\n\n\n Introduce el numero de columnas de la matriz 2:");</span><br />
<span style="font-family: Courier New, Courier, monospace;"> scanf("%d", &Dim[2][2]);</span><br />
<span style="font-family: Courier New, Courier, monospace;"> printf("\n\n INTRODUCIR CADA COMPONENTE DE LA MATRIZ 2:");</span><br />
<span style="font-family: Courier New, Courier, monospace;"> for(A=1;A<= Dim[2][1];A++) for(B=1;B<=Dim[2][2];B++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n Termino M2(%d,%d):",A,B); scanf("%f",&Mat2[A][B]);}</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">void EscribeDatos(int Dim[][3], float Mat[][Tam], int aux)</span><br />
<span style="font-family: Courier New, Courier, monospace;">{</span><br />
<span style="font-family: Courier New, Courier, monospace;"> int A,B;</span><br />
<span style="font-family: Courier New, Courier, monospace;"> if (aux == 1)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n\n M1: \n");</span><br />
<span style="font-family: Courier New, Courier, monospace;"> else if (aux == 2)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n\n M2: \n");</span><br />
<span style="font-family: Courier New, Courier, monospace;"> else</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n\n Resultado: \n");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"> for(A=1;A<=Dim[aux][1];A++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"> for(B=1;B<=(Dim[aux][2]);B++)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("%7.2f",Mat[A][B]);</span><br />
<span style="font-family: Courier New, Courier, monospace;"> printf("\n");</span><br />
<span style="font-family: Courier New, Courier, monospace;"> }</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">void Mult(int Dim[][3], float Mat1[][Tam], float Mat2[][Tam], float Mat3[][Tam])</span><br />
<span style="font-family: Courier New, Courier, monospace;">{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int A, B, aux;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (Dim[1][2]==Dim[2][1])</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Dim[3][1] = Dim[1][1];</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Dim[3][2] = Dim[2][2];</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for (A = 1; A<= Dim[1][1]; A++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for (B = 1; B<= Dim[2][2]; B++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Mat3[A][B] = 0;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for (aux = 1; aux <= Dim[1][2]; aux++)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Mat3[A][B] = Mat3[A][B] + Mat1[A][aux]*Mat2[aux][B];</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>else</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n\n Las matrices no se puden muiltiplicar \n");</span><br />
<br />
}<br />
<br />
<br />
Salu10, espero que les sea útil.<br />
<div>
<br /></div>
Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-1693174021147070350.post-30531256947546966402014-11-08T05:19:00.000-08:002014-11-08T05:19:50.285-08:00Cómo evitar y quitar el doble tick azul de whatsapp<div class="MsoNormal">
<span lang="ES">¿Cómo evitar y
quitar el doble check azul de whatsapp aparezca en tu móvil? Pues bien, como ya
sabrás, desde ayer mismo viene haciendo aparición en todos los smartphones con
whatsapp el dichoso <b>doble tick o check azu</b>l que confirma que el mensaje que se
ha enviado ha sido leído por el destinatario. Si por un motivo o por otro quieres
que este doble tick azul les aparezca a las personas que te envían un mensaje
por whatsapp, te voy a dar una serie de consejos que te podrán ser útiles.</span></div>
<div class="MsoNormal">
<span lang="ES" style="text-indent: -18pt;"><br /></span></div>
<div class="MsoNormal">
<span lang="ES" style="text-indent: -18pt;"> - Lo
primero de todo, hay que explicar qué significa leer un mensaje para whatsapp.
Leer un mensaje, es meterse a la conversación en la que se ha enviado ese
mensaje. Por lo tanto, si lo que quieres es ignorar a una persona de manera
sistemática, sin importar lo que diga, basta con que no te metas en su
conversación para que no le aparezca el doble check. Mientras tanto puedes
seguir utilizando whatsapp para el resto de personas sin necesidad de que la
otra persona se entere de que no le quieres responder. En este sentido es también
aconsejable <b>quitarse la última hora de conexión</b> a la aplicación de whatsapp
para evitar que personas tan impertinentes te estén pidiendo explicaciones de por
qué te has conectado a cierta hora y no has contestado</span><span style="text-indent: -18pt;">.</span></div>
<div class="MsoNormal">
<span style="text-indent: -18pt;"><br /></span></div>
<!--[if !supportLists]--><br />
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="ES" style="font-family: Symbol; mso-ansi-language: ES; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;"> </span></span><span lang="ES">- Por otro lado, si se quiere leer el mensaje pero que no le aparezca como leído a la
otra persona justo a continuación, se puede <b>quitar la conexión datos y el WiFi</b>
justo antes, para leerlo una vez que no se tenga conexión. Con esto se evita
que le aparezca el doble tick azul en whatsapp hasta que vuelvas a tener
conexión a internet.<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<span lang="ES"><br /></span></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<!--[if !supportLists]--><span lang="ES" style="font-family: Symbol; mso-ansi-language: ES; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt; font-stretch: normal;"> </span></span><span lang="ES">- Muy
similar al anterior punto, es configurar el <b>móvil en modo avión</b>, en lugar de
quitar la conexión de datos y WiFi.<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<span lang="ES"><br /></span></div>
<div class="MsoNormal">
<span lang="ES">Seguiremos
investigando posibles otros modos de quitar el doble tick azul de whatsapp. Se
irá aumentado esta lista conforme vayan apareciendo.<o:p></o:p></span></div>
<br />
<div class="MsoNormal">
<span lang="ES">Un saludo y
gracias.<o:p></o:p></span></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1693174021147070350.post-33879451733934623192014-11-03T06:03:00.000-08:002014-11-05T07:17:32.897-08:00¿Cómo funcionan los sistemas electrónicos digitales?<div class="MsoNormal">
¿Cómo funcionan los sistemas electrónicos digitales?<br />
Para entender cómo
funcionan los sistemas digitales, es necesario primero comprender qué es la electrónica
digital y de dónde parte, siendo necesario tener unas buenas bases de
electrónica analógica.</div>
<div class="MsoNormal">
<span lang="ES">Tanto la
electrónica digital como analógica emplean diferentes niveles de tensión para
representar distintas magnitudes físicas, por lo que la electrónica digital no
deja de ser un caso particular de la electrónica analógica. En la electrónica
digital únicamente se restringen los valores de tensión con los que se trabaja,
pasando de un rango de valores continuo, a uno discreto donde simplemente existen
dos valores, que representan el 0 y el 1. Al igual que se discretizan los
valores de la tensión, también se hace lo mismo sobre el tiempo, actualizado el
valor de la tensión cada cierto tiempo fijo que viene determinado por el
inverso de la frecuencia de funcionamiento del sistema digital.<o:p></o:p></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN6z7NIdp8ql49ebz2FHovkQdJ8f2MSXJfsIgKknI0UIF_v0qSqzyd8sYXH98Qzoi1N-xbTxTYQ4A0XmDPXDm-ri_bEk_ahXFu_ErNE4jq8j03S6QLhQQ8sW8hpieHUfvXrRQA4LVz9O4/s1600/f1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN6z7NIdp8ql49ebz2FHovkQdJ8f2MSXJfsIgKknI0UIF_v0qSqzyd8sYXH98Qzoi1N-xbTxTYQ4A0XmDPXDm-ri_bEk_ahXFu_ErNE4jq8j03S6QLhQQ8sW8hpieHUfvXrRQA4LVz9O4/s1600/f1.png" height="133" width="320" /></a></div>
<br />
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="ES">Las principales ventajas
de usar sistemas digitales radican en que las operaciones que se pueden llevar
a cabo son mucho mayores y resultan mucho más sencillas de calcular. Por
ejemplo, usando electrónica analógica, resulta verdaderamente complicado
realizar una multiplicación de dos valores. Sin embargo, con electrónica digital
y unos bloques lógicos (AND, OR, XOR, NAND, NOR) muy sencillos, se puede llevar
a cabo rápidamente.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="ES">Estos bloques
lógicos que constituyen la base de la electrónica digital y los sistemas
digitales, están formados por elementos tales como resistencias, amplificadores
operacionales, diodos y transistores, los cuales, por separado, se comportan
como sistemas analógicos, pero que sin embargo, en conjunto, dotan de cierta “lógica”
al sistema.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="ES"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE6Y312Yuko_B0_6waLvSHQNj9AHi8Z8BWEhDYWCTvoZDOQ13FduT8xLcaLjgAC6TPQ8QoYbYB6wF0sYAhOQB7U1tKKcS6xfEqvU4xeXLD3aNKI3N07nFGTtrb2nwEz5yjEKhogAZDjw0/s1600/f2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE6Y312Yuko_B0_6waLvSHQNj9AHi8Z8BWEhDYWCTvoZDOQ13FduT8xLcaLjgAC6TPQ8QoYbYB6wF0sYAhOQB7U1tKKcS6xfEqvU4xeXLD3aNKI3N07nFGTtrb2nwEz5yjEKhogAZDjw0/s1600/f2.png" height="196" width="320" /></a></div>
<div class="MsoNormal">
La nomenclatura
utilizada para abreviar estas operaciones lógicas es la siguiente:</div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVSLXMM7KZdWvD95DKP_VA9fZRHv4G4tYPqsFeKCejG22JQDQKfsrFnWc_um3NW4KsG5diIK3CvQbXb0DnAw4pa_jZBfUMhkhbhK7fsXqbxhd6L9fU_lD9Cdt9X4UoJAWvGYjeEiAw4uo/s1600/f4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVSLXMM7KZdWvD95DKP_VA9fZRHv4G4tYPqsFeKCejG22JQDQKfsrFnWc_um3NW4KsG5diIK3CvQbXb0DnAw4pa_jZBfUMhkhbhK7fsXqbxhd6L9fU_lD9Cdt9X4UoJAWvGYjeEiAw4uo/s1600/f4.png" height="95" width="320" /></a></div>
<div class="MsoNormal">
<span lang="ES"></span></div>
<div class="MsoNormal">
<br /></div>
Debido a que
existen únicamente dos niveles de tensión, pasa a ser necesario trabajar con un
sistema numérico en base 2, en la que cada uno de los dígitos (También conocido
como bit) un número pueda tener únicamente dos valores. Ésta es la razón por la
cual en los sistemas digitales se trabaja con el sistema binario. Además,
mediante el uso de esta base numérica, las operaciones aritméticas se ven
reducidas a simples operaciones lógicas, por lo que se pueden usar los esquemas
electrónicos antes mostrados para llevar a cabo cualquier operación.<o:p></o:p><br />
<div class="MsoNormal">
<span lang="ES">Por ejemplo, en
el caso de querer sumar dos números binarios de 1 bit cada uno, llamados A y B,
tenemos el siguiente circuito lógico:</span></div>
<div class="MsoNormal">
<span lang="ES"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisH6QXufPLKAujaojofYrYTry0bnQxVV_iZam28m6zPvCRBuB1ihOI7mkw-ZoGykcIMTSjFjt_w3100G2RVzI8OTP70aUNQIBWuAW118HnVU2o0-qcIhVRihE4vMl_aNyPlApZofR97cM/s1600/f3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisH6QXufPLKAujaojofYrYTry0bnQxVV_iZam28m6zPvCRBuB1ihOI7mkw-ZoGykcIMTSjFjt_w3100G2RVzI8OTP70aUNQIBWuAW118HnVU2o0-qcIhVRihE4vMl_aNyPlApZofR97cM/s1600/f3.png" height="93" width="320" /></a></div>
<div class="MsoNormal">
<span lang="ES"><br /></span></div>
<div class="MsoNormal">
<span lang="ES">Donde Cin es el
acarreo anterior (0 o 1), si es que existe, y Cout es el acarreo de salida (0 o
1) <o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="ES">Donde también se
muestra la nomenclatura utilizada para abreviar la representación del sumador
en los esquemas electrónicos.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="ES">Si ahora lo que
se pretende es sumar números binarios con más bits, tal que A = (An-1, … , A1,
A0) y B = (Bn-1, … , B1, B0) donde cada Ai y Bi toman o 1 o 0, basta con
concatenar varios sumadores de la manera siguiente.<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyRvYb3xcrifTjs28ecV2wdRZMF038gwT99e1V_qWHSwkP-exZePsax-tNSnm95kTAf8YGxdPklLo1Vnk-FYYRC9o3bS8bSHP8vVwYhBdCyqZo_BHOf9Lobcs1FU-1MucOwUZRl0qVHS8/s1600/f5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyRvYb3xcrifTjs28ecV2wdRZMF038gwT99e1V_qWHSwkP-exZePsax-tNSnm95kTAf8YGxdPklLo1Vnk-FYYRC9o3bS8bSHP8vVwYhBdCyqZo_BHOf9Lobcs1FU-1MucOwUZRl0qVHS8/s1600/f5.png" height="189" width="320" /></a></div>
<div class="MsoNormal">
Así, mediante este
proceso de síntesis que se ha llevado a cabo para la suma, se ha podido pasar
de las operaciones lógicas sencillas, a bloques operacionales y sistemas
digitales capaces de llevar a cabo operaciones aritméticas mucho más complejas.
Esto se puede repetir para cada una de las operaciones aritméticas con números
binarios que se pueda imaginar. Como resumen de este proceso, el gráfico
siguiente:</div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhb1NIqpQLqObY5yUoHYUuuS5XFFcpBqVMKDNsaftosFQDBVWDp6yztuGkf8raMNFEFWGjOZuNYeDNqoZDOO-z2ERl04wx00Y9zRZODPuM95EdlG3R6kgaawUC3LY3zOJGx_Ilk6JU058Y/s1600/f6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhb1NIqpQLqObY5yUoHYUuuS5XFFcpBqVMKDNsaftosFQDBVWDp6yztuGkf8raMNFEFWGjOZuNYeDNqoZDOO-z2ERl04wx00Y9zRZODPuM95EdlG3R6kgaawUC3LY3zOJGx_Ilk6JU058Y/s1600/f6.png" height="160" width="320" /></a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
Se observa que en
la cúspide de la pirámide se encuentran los elementos más sencillos y menos
numerosos, mientras que en la parte inferior se encuentran los más complejos y
los más numerosos.</div>
<div class="MsoNormal">
<span lang="ES">Por lo tanto,
queda únicamente el reto de ser capaces de modificar esas conexiones entre los
elementos primarios (Resistencias, diodos, transistores…) para poder implementar
todas las operaciones aritméticas y poder tener un sistema digital programable.
Esto se consigue mediante interruptores controlados, formados por transistores.<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="ES">Se ha podido ver
de forma muy simplificada, cómo se puede pasar de un sistema que está formado únicamente
por resistencias, diodos y transistores, a un sistema programable de mucha
mayor complejidad. Espero que este artículo les haya sido útil, para cuanto
menos, poder entender grosso modo como trabajan los numerosos sistemas
digitales que utilizamos en nuestra vida diaria.<o:p></o:p></span></div>
<br />
<div class="MsoNormal">
<span lang="ES">Un saludo.<o:p></o:p></span></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1693174021147070350.post-89905297727923037092014-09-07T07:56:00.000-07:002014-09-07T08:04:35.789-07:00GUI MatLab: Representa y Guarda Imagen.La siguiente interfaz gráfica de usuario (GUI) de MatLab imprime en una venta la función sen(x) en este caso, a la vez que la guarda en formato figure de MatLab en el directorio donde se encuentre el programa con el nombre '#Seno.fig'.<br />
Los componentes de la ventana son dos, un botón (PushButtons) llamado Dibuja, y unos ejes (Axes) llamados Grafica:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4_VgSjZsdnK9KD_RT8DPPVY0_fjEB2o8oUZHZPgjU7bFisEYGXbt_KmUar4uosP7iLDQeq83h87Jq9i4nrHBFIeSuTVBCgX9L7iS2zoVqtV_MzpfkLNzbMcnlsL0yOaZAfPdlopjmM9E/s1600/Captura1.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4_VgSjZsdnK9KD_RT8DPPVY0_fjEB2o8oUZHZPgjU7bFisEYGXbt_KmUar4uosP7iLDQeq83h87Jq9i4nrHBFIeSuTVBCgX9L7iS2zoVqtV_MzpfkLNzbMcnlsL0yOaZAfPdlopjmM9E/s1600/Captura1.PNG" height="283" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
El código es el siguiente:</div>
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">function varargout = GUI1Grafica(varargin)</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">gui_Singleton = 1;</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">gui_State = struct('gui_Name', mfilename, ...</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;"> 'gui_Singleton', gui_Singleton, ...</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;"> 'gui_OpeningFcn', @GUI1Grafica_OpeningFcn, ...</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;"> 'gui_OutputFcn', @GUI1Grafica_OutputFcn, ...</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;"> 'gui_LayoutFcn', [] , ...</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;"> 'gui_Callback', []);</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">if nargin && ischar(varargin{1})</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;"> gui_State.gui_Callback = str2func(varargin{1});</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">end</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">if nargout</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;"> [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">else</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;"> gui_mainfcn(gui_State, varargin{:});</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">end</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">function GUI1Grafica_OpeningFcn(hObject, eventdata, handles, varargin)</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">handles.output = hObject;</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">guidata(hObject, handles);</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">function varargout = GUI1Grafica_OutputFcn(hObject, eventdata, handles) </span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">varargout{1} = handles.output;</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">function dibuja_Callback(hObject, eventdata, handles)</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">a = 0 : pi/10 : 2*pi;</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">% Se representa la gráfica</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">hold on;</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">plot(handles.Grafica,a,sin(a));</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">legend(handles.Grafica,'Función Seno');</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">hold off</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">% Se guarda la gráfica</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">hold on;</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">Fig1 = figure;</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">AxesH = axes;</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">plot(a,sin(a));</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">legend('Función Seno');</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">Fig2 = figure;</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">copyobj(AxesH, Fig2);</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">hgsave(Fig1, '#Seno.fig');</span></div>
<div class="separator" style="clear: both; text-align: justify;">
<span style="font-family: Courier New, Courier, monospace;">hold off;</span></div>
<br />
<span style="font-family: Times, Times New Roman, serif;">La ejecución del programa queda con se ve a continuación:</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0p6smTcBq2btE7xM7MOIrjF5TtsJmXXZpnKJgi-BbeJ6H3LWerQ0QHEXrw8QS9-DLxEYtKp4WGn-M32a07NK5HJlejrgcYJdAx7Db2BnTMUlVc6r4s8lEtkc8zWtlm32RUYKMmlRV_ws/s1600/Captura2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0p6smTcBq2btE7xM7MOIrjF5TtsJmXXZpnKJgi-BbeJ6H3LWerQ0QHEXrw8QS9-DLxEYtKp4WGn-M32a07NK5HJlejrgcYJdAx7Db2BnTMUlVc6r4s8lEtkc8zWtlm32RUYKMmlRV_ws/s1600/Captura2.PNG" height="291" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Un saludo.</div>
<span style="font-family: Times, Times New Roman, serif;"><br /></span>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1693174021147070350.post-66013569558721722932013-05-22T06:00:00.000-07:002016-06-05T12:32:45.471-07:00Método de Gauss para Resolver Sistemas de Ecuaciones en C/C++Aquí dejo el código para <b>resolver sistemas de ecuaciones mediante Gauss</b> con la pequeña correción, pero importante, comentada en el <a href="http://cypascal.blogspot.com.es/2012/09/resolver-sudokus-en-cc.html">tema de Método de Gauss</a>:<br />
<br />
<br />
<br />
<br />
<pre style="display: inline; margin-top: 0;">#include <stdio.h>
void PideDatos(int *Dim, float Sist[][102]);
void EscribeDatos(int Dim, float Sist[][102]);
void ResuelveGauss(int Dim, float Sist[][102]);
int main(void)
{
int C,Dimension;
float Sistema[101][102];
PideDatos(&Dimension,Sistema);
printf("\n\n\nEl SISTEMA introducido es el siguiente: \n\n");
EscribeDatos(Dimension,Sistema);
ResuelveGauss(Dimension,Sistema);
printf("\n\n\nLas soluciones son:\n");
for(C=1;C<=Dimension;C++) printf("\n X%d=%f\n",C,Sistema[C][Dimension+1]);
scanf("");
return(0);
}
void PideDatos(int *Dim,float Sist[][102])
{
int A,B;
printf("\n\n ||RESUELVE SISTEMAS LINEALES DETERMINADOS POR GAUSS||");
printf("\n\n\n Introduce el numero de incognitas:(menor que 100)");
scanf("%d",&*Dim);
printf("\n\n PASE A INTRODUCIR CADA COMPONENTE DEL SISTEMA (A|B):");
printf("\n\n MATRIZ A:\n");
for(A=1;A<=*Dim;A++) for(B=1;B<=*Dim;B++){
printf("\n Termino A(%d,%d):",A,B); scanf("%f",&Sist[A][B]);}
printf("\n\n\n VECTOR B:\n");
for(A=1;A<=*Dim;A++){
printf("\n Termino B(%d):",A);scanf("%f",&Sist[A][*Dim+1]);
}}
void EscribeDatos(int Dim, float Sist[][102])
{
int A,B;
for(A=1;A<=Dim;A++){
for(B=1;B<=(Dim+1);B++){
printf("%7.2f",Sist[A][B]);
if(B==Dim) printf(" |");}
printf("\n");
}}
void ResuelveGauss(int Dim, float Sist[][102])
{
int NoCero,Col,C1,C2,A;
float Pivote,V1;
for(Col=1;Col<=Dim;Col++){
NoCero=0;A=Col;
while(NoCero==0){
if((Sist[A][Col]>0.0000001)||((Sist[A][Col]<-0.0000001))){
NoCero=1;}
else A++;}
Pivote=Sist[A][Col];
for(C1=1;C1<=(Dim+1);C1++){
V1=Sist[A][C1];
Sist[A][C1]=Sist[Col][C1];
Sist[Col][C1]=V1/Pivote;}
for(C2=Col+1;C2<=Dim;C2++){
V1=Sist[C2][Col];
for(C1=Col;C1<=(Dim+1);C1++){
Sist[C2][C1]=Sist[C2][C1]-V1*Sist[Col][C1];}
}}
for(Col=Dim;Col>=1;Col--) for(C1=(Col-1);C1>=1;C1--){
Sist[C1][Dim+1]=Sist[C1][Dim+1]-Sist[C1][Col]*Sist[Col][Dim+1];
Sist[C1][Col]=0;
}
}</pre>
<br />
<br />
<pre style="display: inline; margin-top: 0;"> </pre>
<br />
<br />
<pre style="display: inline; margin-top: 0;"><span style="font-family: "arial" , "helvetica" , sans-serif;">Un saludo. </span></pre>
Unknownnoreply@blogger.com23tag:blogger.com,1999:blog-1693174021147070350.post-36324966719261530822013-05-15T13:30:00.000-07:002013-05-15T13:45:31.286-07:00Succesión de Fibonacci en CEl programa calcula e imprime en pantalla los valores de los términos de la famosa <b>sucesión de Fibonacci. </b>Cada término de la sucesión de Fibonacci se define como la suma de los dos términos anteriores. Las dos primeras componentes de la sucesión son 1 y 1, a partir de los cuales se pueden sacar todos los demás términos.<br />
Esta sucesión es muy utilizada para describir distintos fenómenos, como son el crecimiento de una población de conejos en medio salvaje y sin depredadores. También nos permite modelar otros fenómenos como son el crecimiento de muchas plantas o el de las galaxias.<br />
<br />
Aquí pongo el <b>Código de la sucesión de Fibonacci en C</b>:<br />
<br />
<br />
<br />
<i>/*PROGRAMA PARA CALCULARA LA SERIE DE FRIBONACCI EN C/C++*/</i><br />
<i>#include <stdio.h></i><br />
<i><br /></i>
<i>int ind,c,ter1=1,ter2=0;</i><br />
<i>char imp,corr=0;</i><br />
<i><br /></i>
<i>int main(void)</i><br />
<i>{</i><br />
<i> int aux;</i><br />
<i><br /></i>
<i> printf("CALCULA LA SERIE DE FIBONACCI:");</i><br />
<i> printf("Introduce el indice a calcular: ");</i><br />
<i> fflush(stdin); scanf("%i",&ind);</i><br />
<i> while (corr==0)</i><br />
<i> {</i><br />
<i> printf("Quieres imprimir toda la serie? (S=Si,N=No): ");</i><br />
<i> fflush(stdin);</i><br />
<i> scanf("%c",&imp);</i><br />
<i> if ((imp=='S')||(imp=='s'))</i><br />
<i> {</i><br />
<i> printf("\nLa serie hasta el termino %i es:\n",ind);</i><br />
<i> for(c=1;c<=ind;c++)</i><br />
<i> {</i><br />
<i> printf("%6i",ter1);</i><br />
<i> aux=ter2;</i><br />
<i> ter2=ter1;</i><br />
<i> ter1=ter1+aux;</i><br />
<i> }</i><br />
<i> corr=1;</i><br />
<i> }</i><br />
<i> else if ((imp=='N')||(imp=='n'))</i><br />
<i> {</i><br />
<i> for(c=1;c<=ind;c++)</i><br />
<i> {</i><br />
<i> aux=ter2;</i><br />
<i> ter2=ter1;</i><br />
<i> ter1=ter1+aux;</i><br />
<i> }</i><br />
<i> printf("El termino %i vale: %i",ind,ter2);</i><br />
<i> corr=1;</i><br />
<i> }</i><br />
<i> else printf("Solo puede introducir N o S.\n\n");</i><br />
<i>}}</i><br />
<i><br /></i>
<i><br /></i>
Se ha utilizado la función fflush para limpiar el buffer del teclado, ya que daba probelmas.<br />
<br />
Un saludo.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1693174021147070350.post-31344327306632982262013-05-12T13:20:00.003-07:002014-10-31T10:49:18.161-07:00Método Burbuja de Ordenación en C/C++A continuación se presenta el código del <b>método de ordenación</b> denominado <b>BURBUJA</b>, que nos permite ordenar las componentes de un array de mayor a menor. El método consiste en ir comparando parejas de números consecutivos del array, y si el de segundo es mayor que el primero, el primero pasa a ser el segundo y viceversa. Este proceso se realiza a lo largo de todo el array tantas veces como sea necesario hasta que no se produzcan cambio (Por eso el uso de la bandera cambios). El resultado es el array ordenado de manera descendente.<br />
<br />
Aquí les dejo una captura del programa:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi944qK5DktgXtvXGsv9J6zXiFEFU4IEOhxF_YZZp7iz_r6yqRBZtbM2hCC0jItxJpYu5798DmzBYEVwbERjy-9sDvfBdzvOHSbwmEYzUelDnoVc4eB29Yufq23KwK9261aJnOJWafxT_o/s1600/captura.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi944qK5DktgXtvXGsv9J6zXiFEFU4IEOhxF_YZZp7iz_r6yqRBZtbM2hCC0jItxJpYu5798DmzBYEVwbERjy-9sDvfBdzvOHSbwmEYzUelDnoVc4eB29Yufq23KwK9261aJnOJWafxT_o/s320/captura.png" height="263" width="320" /></a></div>
<br />
Y aquí el código:<br />
<br />
<br />
<br />
<br />
<i>/*METODO BURBUJA DE ORDENACIÓN*/</i><br />
<i>#include <stdio.h></i><br />
<i><br /></i>
<i>int const Tam=100;</i><br />
<i>int N,C;</i><br />
<i><br /></i>
<i>void ordena(float dats[], int dim);</i><br />
<i>void imprime(float dats[], int dim);</i><br />
<i><br /></i>
<i>int main(void)</i><br />
<i>{</i><br />
<i> float datos[Tam];</i><br />
<i> printf("Numero que vas a introducir:");scanf("%i",&N);</i><br />
<i> for(C=1;C<=N;C++)</i><br />
<i> {</i><br />
<i> printf("Numero %i: ",C);scanf("%f",&datos[C]);</i><br />
<i> }</i><br />
<i> ordena(datos,N);</i><br />
<i> imprime(datos,N);</i><br />
<i> return 0;</i><br />
<i>}</i><br />
<i><br /></i>
<i>void ordena(float dats[],int dim)</i><br />
<i>{</i><br />
<i> float aux;</i><br />
<i><br /></i>
<i> int cambio=1,cont;</i><br />
<i> while (cambio==1)</i><br />
<i> {</i><br />
<i> cambio=0;</i><br />
<i> for(cont=1;cont<dim;cont++)</i><br />
<i> if(dats[cont]<dats[cont+1]){</i><br />
<i> aux=dats[cont];</i><br />
<i> dats[cont]=dats[cont+1];</i><br />
<i> dats[cont+1]=aux;</i><br />
<i> cambio=1;</i><br />
<i> }}</i><br />
<i>}</i><br />
<i><br /></i>
<i>void imprime(float dats[], int dim)</i><br />
<i>{</i><br />
<i> printf("\n\nEl vector ordenado de mayor a menor es el siguiente:\n");</i><br />
<i> int cont;</i><br />
<i> for(cont=1;cont<=dim;cont++) printf("%f\n",dats[cont]);</i><br />
<i>}</i><br />
<div>
<br /></div>
<div>
<br /></div>
<div>
Saludos.</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1693174021147070350.post-20114871638272949122013-04-30T10:52:00.000-07:002014-10-31T10:50:03.212-07:00Calculo Determinante de una Matriz en C/C++Calcula el <b>determinante de una matriz</b>, previo escalonamiento (<a href="http://cypascal.blogspot.com.es/2012/10/metodo-de-gauss-en-cc.html">método de gauss-jordan</a>), mediante la multiplicación de los términos de su diagonal.<br />
El hecho de realizar permutaciones entre filas, o la suma y resta entre filas, no afecta al módulo del determinante de la matriz, pero si al signo (Fácilmente verificable).<br />
El signo se ve afectado por cada permutación realizada para llegar a la matriz escalonada. Es decir, si el número de permutaciones realizadas es un número par, el producto de los términos de la diagonal será el determinante. Si por el contrario, las permutaciones realizadas son impares, el determinante será el producto de los términos de la diagonal pero cambiados de signo.<br />
Este método es mucho más eficiente que el usado anteriormente en otros programas (<a href="http://cypascal.blogspot.com.es/2013/04/calculo-del-determinante-en-cc.html">Aquí en C</a> y <a href="http://cypascal.blogspot.com.es/2011/07/calculo-del-determinante.html">aquí en Pascal</a>) que trabajaba con funciones recursivas y que estaban basados en el desarrollo de Laplace.<br />
<br />
<br />
<br />
<br />
Aquí les dejo el código:<br />
<br />
<br />
<i>#include <stdio.h></i><br />
<i><br /></i>
<i>int const Tam=101;</i><br />
<i><br /></i>
<i>void PideDatos(int *Dim, float Mat[][Tam]);</i><br />
<i>void EscribeDatos(int Dim, float Mat[][Tam]);</i><br />
<i>void </i><i>CalcDet</i><i>(int Dim, float Mat[][Tam]);</i><br />
<i><br /></i>
<i><br /></i>
<i>int main(void)</i><br />
<i>{</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>int C,Dimension;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>float Matriz[Tam][Tam];</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>PideDatos(&Dimension,Matriz);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n\n\nCalcula DETERMINANTE: \n\n");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>EscribeDatos(Dimension,Matriz);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span></i><i>CalcDet</i><i>(Dimension,Matriz);</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>scanf("%d");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>return(0);</i><br />
<i>}</i><br />
<i><br /></i>
<i><br /></i>
<i>void PideDatos(int *Dim,float Mat[][Tam])</i><br />
<i>{</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>int A,B;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n\n ||CALCULA DETERMINANTE ESCALONANDO MATRIZ||");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n\n\n Introduce la dimension de la matriz:");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>scanf("%d",&*Dim);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n\n INTRODUCIR CADA COMPONENTE DE LA MATRIZ:");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>for(A=1;A<=*Dim;A++) for(B=1;B<=*Dim;B++){</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n Termino A(%d,%d):",A,B); scanf("%f",&Mat[A][B]);}</i><br />
<i>}</i><br />
<i><br /></i>
<i>void EscribeDatos(int Dim, float Mat[][Tam])</i><br />
<i>{</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>int A,B;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>for(A=1;A<=Dim;A++){</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>for(B=1;B<=(Dim);B++)</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("%7.2f",Mat[A][B]);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>}}</i><br />
<i><br /></i>
<i>void CalcDet(int Dim, float Mat[][Tam])</i><br />
<i>{</i><br />
<i> int NoCero,Col,C1,C2,A,NoReg,Perm=0/*permutaciones*/;</i><br />
<i> float Pivote,V1,Det=1;</i><br />
<i><br /></i>
<i> for(Col=1;Col<=Dim;Col++){</i><br />
<i> NoCero=0;A=Col;</i><br />
<i> while((NoCero==0)&&(A<=Dim)){</i><br />
<i> if((Mat[A][Col]>0.0000001)||((Mat[A][Col]<-0.0000001))){</i><br />
<i> NoCero=1;}</i><br />
<i> else A++;}</i><br />
<i> if (A>Dim) NoReg=1;</i><br />
<i> if (A!=Col) Perm++;</i><br />
<i> Pivote=Mat[A][Col];</i><br />
<i> for(C1=1;C1<=(Dim);C1++){</i><br />
<i> V1=Mat[A][C1];</i><br />
<i> Mat[A][C1]=Mat[Col][C1];</i><br />
<i> Mat[Col][C1]=V1;}</i><br />
<i> for(C2=Col+1;C2<=Dim;C2++){</i><br />
<i> V1=Mat[C2][Col];</i><br />
<i> for(C1=Col;C1<=(Dim);C1++){</i><br />
<i> Mat[C2][C1]=Mat[C2][C1]-((V1/Pivote)*Mat[Col][C1]);}}</i><br />
<i> }</i><br />
<i> for(C2=1;C2<=Dim;C2++) Det=Det*Mat[C2][C2];</i><br />
<i> A=Perm;</i><br />
<i> if ((A%2)==1) Det=-Det; /*Caso de permutaciones impares*/</i><br />
<i> if (NoReg==1) Det=0;</i><br />
<i> printf("El determinante de la matriz es: %f", Det);</i><br />
<i><br /></i>
<i>}</i><br />
<br />
<div>
<br /></div>
<div>
<br /></div>
<div>
Y aquí el código para poner a prueba el programa. Se introduce el tamaño de la matriz, el programa genera todas las componentes de la matriz de manera aleatoria (Únicamente introduce 1s y 0s), y se calcula su determinante:</div>
<div>
<br /></div>
<div>
(Se ha dejado comentada la función para imprimir la matriz)</div>
<div>
<br />
<i>#include <stdio.h></i><br />
<i>#include <stdlib.h> /*Para los números aleatorios*/</i><br />
<i><br /></i>
<i>int const Tam=200;</i><br />
<i><br /></i>
<i>void PideDatos(int *Dim, float Mat[][Tam]);</i><br />
<i>void EscribeDatos(int Dim, float Mat[][Tam]);</i><br />
<i>void CalcDet(int Dim, float Mat[][Tam]);</i><br />
<i><br /></i>
<i><br /></i>
<i>int main(void)</i><br />
<i>{</i><br />
<i> int C,Dimension;</i><br />
<i> float Matriz[Tam][Tam];</i><br />
<i> PideDatos(&Dimension,Matriz);</i><br />
<i> printf("\n\n\nCalcula DETERMINANTE: \n\n");</i><br />
<i> EscribeDatos(Dimension,Matriz);</i><br />
<i> CalcDet(Dimension,Matriz);</i><br />
<i><br /></i>
<i> scanf("%d");</i><br />
<i> return(0);</i><br />
<i>}</i><br />
<i><br /></i>
<i><br /></i>
<i>void PideDatos(int *Dim,float Mat[][Tam])</i><br />
<i>{</i><br />
<i> int A,B;</i><br />
<i> printf("\n\n ||CALCULA DETERMINANTE ESCALONANDO MATRIZ||");</i><br />
<i> printf("\n\n\n Introduce la dimension de la matriz:");</i><br />
<i> scanf("%d",&*Dim);</i><br />
<i> for(A=1;A<=*Dim;A++) for(B=1;B<=*Dim;B++)</i><br />
<i> Mat[A][B]=rand()%2;</i><br />
<i>}</i><br />
<i><br /></i>
<i>void EscribeDatos(int Dim, float Mat[][Tam])</i><br />
<i>{</i><br />
<i> int A,B;</i><br />
<i> for(A=1;A<=Dim;A++){</i><br />
<i> for(B=1;B<=(Dim);B++)</i><br />
<i> printf("%7.2f",Mat[A][B]);</i><br />
<i> printf("\n");</i><br />
<i> }}</i><br />
<i><br /></i>
<i>void CalcDet(int Dim, float Mat[][Tam])</i><br />
<i>{</i><br />
<i> int NoCero,Col,C1,C2,A,NoReg,Perm=0/*permutaciones*/;</i><br />
<i> float Pivote,V1,Det=1;</i><br />
<i><br /></i>
<i> for(Col=1;Col<=Dim;Col++){</i><br />
<i> NoCero=0;A=Col;</i><br />
<i> while((NoCero==0)&&(A<=Dim)){</i><br />
<i> if((Mat[A][Col]>0.0000001)||((Mat[A][Col]<-0.0000001))){</i><br />
<i> NoCero=1;}</i><br />
<i> else A++;}</i><br />
<i> if (A>Dim) NoReg=1;</i><br />
<i> if (A!=Col) Perm++;</i><br />
<i> Pivote=Mat[A][Col];</i><br />
<i> for(C1=1;C1<=(Dim);C1++){</i><br />
<i> V1=Mat[A][C1];</i><br />
<i> Mat[A][C1]=Mat[Col][C1];</i><br />
<i> Mat[Col][C1]=V1;}</i><br />
<i> for(C2=Col+1;C2<=Dim;C2++){</i><br />
<i> V1=Mat[C2][Col];</i><br />
<i> for(C1=Col;C1<=(Dim);C1++){</i><br />
<i> Mat[C2][C1]=Mat[C2][C1]-((V1/Pivote)*Mat[Col][C1]);}}</i><br />
<i> }</i><br />
<i> for(C2=1;C2<=Dim;C2++) Det=Det*Mat[C2][C2];</i><br />
<i> A=Perm;</i><br />
<i> if ((A%2)==1) Det=-Det; /*Caso de permutaciones impares*/</i><br />
<i> if (NoReg==1) Det=0;</i><br />
<i> printf("El determinante de la matriz es: %f", Det);</i><br />
<i><br /></i>
<i>}</i></div>
<br />
<br />
<br />
Un saludo.<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1693174021147070350.post-224099496035136512013-04-29T14:57:00.000-07:002013-05-11T10:38:49.446-07:00Chonificador en C/C++Este programa convierte un texto escrito correctamente, a otro texto semejante, pero esta vez escrito por un Choni (Llámese Choni, Pituti, Nini, Macarra, Bacala...).<br />
Se introduce el nombre del fichero de texto a convertir y ya está. Este programa sirve para ver el uso de los ficheros de texto, y trabajar con caracteres ASCII.<br />
<br />
Y por si algún Choni le da por hacer algo útil:<br />
<br />
<br />
<br />
ESteee PrOgrAmaaa KoNvIerTEEE un texTOOO ESKritOOO KoRreKtaMEnTE, AAA OTRooo TExTOOO shEMEJanTE, pErooo EstAAA VeZ eSKriTooo PoR Un XonIII (LLámeshEEE Xoni, PITuti, NINI, MaKaRrA, BAKaLA...).<br />
ShEEE INTrODUKeee eL NOmbrEEE dEL fIXeRooo deee texTOOO AAA KoNVertIr Y yAAA eSTá. EstEEE pROGRAMAAA shirVEEE Paraaa ver eL UShOOO DEEE LOS fIXErOS dEEE TExTO, Y TRaBaJaR Kon KarAKterEs ASKII.<br />
<br />
(¡¡Oh Dios!! ¡Cuántas cosas subrayadas en rojo!)<br />
<br />
<br />
Las chonificaciones realizadas son:<br />
1º) Alternancia de mayúsculas y minúsculas.<br />
2º) Cambio de C por K.<br />
3º) Cambio de QU por Q.<br />
4º) Cambio de CH por X.<br />
5º) Multiplicar el numero de vocales al final de una palabra.<br />
6º) Introduce H entre S y vocal. (Doy fe de que lo he visto por ahí).<br />
7º) Coloca H al final de las palabras acabadas en vocal.<br />
<br />
<br />
Ejemplo de ejecución:<br />
<br />
Nombre del fichero:<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGjuOXe3sG25kmYHF6gl8L8fksT9t8qF4nF43F7fX1X8Y84iaD4jR-WtYwNBjoXthlm0azAuAi0LjW0HYMDVR4cyNAIvQfRu-Oiu08BcoV8L0EeH8lqURSkjeznT33HS7LkhqExYBSmbQ/s1600/comando.PNG" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-right: 1em; text-align: center;"><img border="0" height="39" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGjuOXe3sG25kmYHF6gl8L8fksT9t8qF4nF43F7fX1X8Y84iaD4jR-WtYwNBjoXthlm0azAuAi0LjW0HYMDVR4cyNAIvQfRu-Oiu08BcoV8L0EeH8lqURSkjeznT33HS7LkhqExYBSmbQ/s320/comando.PNG" width="320" /></a><br />
<br />
Entrada y Salida:<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif7b6BKeSWajQR7sDEpzzaTucNDJF1wwllgubuJCl5V1dvjzFmRJUsJFqRJZZnF2_1YPdE-ZnSIWARhzWYDd48ya1xcm5EPU9U6ISDYZ3NKbLTna0EVjffsd189Ec-zpAZaqD_rbxZNmE/s1600/Captura.PNG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="236" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif7b6BKeSWajQR7sDEpzzaTucNDJF1wwllgubuJCl5V1dvjzFmRJUsJFqRJZZnF2_1YPdE-ZnSIWARhzWYDd48ya1xcm5EPU9U6ISDYZ3NKbLTna0EVjffsd189Ec-zpAZaqD_rbxZNmE/s320/Captura.PNG" width="320" /></a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGjuOXe3sG25kmYHF6gl8L8fksT9t8qF4nF43F7fX1X8Y84iaD4jR-WtYwNBjoXthlm0azAuAi0LjW0HYMDVR4cyNAIvQfRu-Oiu08BcoV8L0EeH8lqURSkjeznT33HS7LkhqExYBSmbQ/s1600/comando.PNG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a></div>
<br />
<br />
CODIGO:<br />
<br />
<br />
<br />
<br />
<i>/*Programa para convertir de lenguaje de humano, a lenguaje Choni*/</i><br />
<i><br /></i>
<i>#include <stdio.h></i><br />
<i>#include <string.h></i><br />
<i>#include <stdlib.h></i><br />
<i><br /></i>
<i>int main(void)</i><br />
<i>{</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>FILE *dat,*dat2;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>int const ascii='a'-'A';</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>char nombre[50],C1,Voc,antVoc,mayus,antS,antQ,imp,leida;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>int a;</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("Nombre del fichero a leer (Con la extension .txt): "); </i><br />
<i> scanf("%s", &nombre);</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>if (fopen(nombre,"r")==NULL) </i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\nEl fichero no existe.\n\n");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>else</i><br />
<i> {</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>dat=fopen(nombre,"r");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>dat2=fopen("SalidaChoni.txt","w");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>fscanf(dat,"%c",&C1);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>antS=antVoc=antQ=imp=leida=0;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>while (!feof(dat))</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>{</i><br />
<i> /*Sortea si se pasa de minus a myus*/</i><br />
<i> mayus=(rand()%7)+1;</i><br />
<i> imp=0;<span class="Apple-tab-span" style="white-space: pre;"> </span></i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i> /*Chonifica minúsculas a mayúsculas*/ </i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>if (((C1<='z')&&(C1>='a'))&&(mayus<5)) C1=C1-ascii;</i><br />
<i> </i><br />
<i> </i><br />
<i> </i><br />
<i> /*Imprime en fichero de salida*/</i><br />
<i> /*Mete H entre S y vocal*/</i><br />
<i> if ((antS==1)&&((C1=='A')||(C1=='E')||(C1=='I')||(C1=='O')||(C1=='U')</i><br />
<i> ||(C1=='a')||(C1=='e')||(C1=='i')||(C1=='o')||(C1=='u')))</i><br />
<i> {</i><br />
<i> fprintf(dat2,"%c",'h');</i><br />
<i> fprintf(dat2,"%c",C1); </i><br />
<i> imp=1;</i><br />
<i> }</i><br />
<i> </i><br />
<i> /*Si la última letra de la palabra es una vocal, la multiplica por 3*/</i><br />
<i> if ((antVoc==1)&&(C1==' '))</i><br />
<i> {</i><br />
<i> fprintf(dat2,"%c",Voc);fprintf(dat2,"%c",'h');</i><br />
<i> fprintf(dat2,"%c",C1);</i><br />
<i> imp=1; </i><br />
<i> }</i><br />
<i> </i><br />
<i> /*Quita la u a la partícula qu*/</i><br />
<i> if (antQ==1) imp=1; </i><br />
<i> </i><br />
<i> /*Pasa de ch a x*/</i><br />
<i> if ((C1=='C')||(C1=='c')) </i><br />
<i> {</i><br />
<i> fscanf(dat,"%c",&C1); </i><br />
<i> if ((C1=='H')||(C1=='h')) fprintf(dat2,"%c",'X');</i><br />
<i> else </i><br />
<i> {</i><br />
<i> leida=1;</i><br />
<i> if ((C1=='A')||(C1=='O')||(C1=='U')||(C1=='a')||(C1=='o')||</i><br />
<i> (C1=='u')) fprintf(dat2,"%c",'K');</i><br />
<i> else fprintf(dat2,"%c",'C');</i><br />
<i> if (!feof(dat)) fprintf(dat2,"%c",C1);</i><br />
<i> }</i><br />
<i> imp=1;</i><br />
<i> }</i><br />
<i> </i><br />
<i> /*Imprime en el caso de que se tenga que imprimir*/</i><br />
<i> if (imp==0) fprintf(dat2,"%c",C1);</i><br />
<i> </i><br />
<i> antS=antVoc=antQ=imp=leida=0;</i><br />
<i> </i><br />
<i> /*Actualiza valor de anteriores*/</i><br />
<i> if ((C1=='A')||(C1=='E')||(C1=='I')||(C1=='O')||(C1=='U')</i><br />
<i> ||(C1=='a')||(C1=='e')||(C1=='i')||(C1=='o')||(C1=='u'))</i><br />
<i> {</i><br />
<i> antVoc=1;</i><br />
<i> Voc=C1;</i><br />
<i> }</i><br />
<i> </i><br />
<i> if ((C1=='q')||(C1=='Q')) antQ=1;</i><br />
<i> </i><br />
<i> if ((C1=='S')||(C1=='s')) antS=1;</i><br />
<i> </i><br />
<i> if (leida==0) fscanf(dat,"%c",&C1);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>}</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>fclose(dat);</i><br />
<i> fclose(dat2);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>}</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>return 0;</i><br />
<i>}</i><br />
<br />
<i><br /></i>Aquí también un enlace con el Chonificador para que se pueda probar:<br />
<a href="http://gomorria.webcindario.com/chonificador.php">Chonificador.</a><br />
<br />
Acepto sugerencias para seguir chonificando.<br />
<br />
<br />
<br />Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-1693174021147070350.post-5505241366138038722013-04-28T13:28:00.002-07:002013-05-11T12:26:23.441-07:00Calculo matriz INVERSA en C/C++El siguiente programa es semejante al desarrollado anteriormente en <a href="http://cypascal.blogspot.com.es/2011/08/inversa-de-una-matriz-mediante.html">Pascal</a>. Comparte gran parte de la estructura con el programa que resuelve sistemas mediante Gauss (<a href="http://cypascal.blogspot.com.es/2012/10/metodo-de-gauss-en-cc.html">Entrada</a>) Se calcula la matriz <b>inversa</b>, realizando las mismas operaciones que se realizan para diagonalizar la matriz, sobre la matriz unidad. Finalmente, después de todas las transformaciones sobre la matriz identidad, obtenemos la <b>matriz inversa</b>. Este método es el más simple a la hora de obtener la matriz inversa.<br />
Hay que recordar que para que una matriz se pueda invertir, tiene que ser no singular, es decir, con determinante distinto de cero.<br />
<br />
Puedes comprobar si la matriz tiene determinante nulo con el código del enlace siguiente.<br />
<a href="http://cypascal.blogspot.com.es/2013/04/calculo-determinante-en-c.html">DETERMINANTE</a><br />
<br />
CODIGO:<br />
<br />
<br />
<i>#include <stdio.h></i><br />
<i><br /></i>
<i>int const Tam=100;</i><br />
<i>void PideDatos(int *Dim, float Sist[][Tam]);</i><br />
<i>void EscribeDatos(int Dim, float Sist[][Tam]);</i><br />
<i>void Invierte(int Dim, float Sist[][Tam], float Inv[][Tam]);</i><br />
<i><br /></i>
<i><br /></i>
<i>int main(void)</i><br />
<i>{</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>int C,Dimension;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>float Sistema[Tam][Tam],Inversa[Tam][Tam];</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>PideDatos(&Dimension,Sistema);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n\n\nLa matriz introducida es la siguiente: \n\n");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>EscribeDatos(Dimension,Sistema);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>Invierte(Dimension,Sistema,Inversa);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n\n\nLa inversa de la matriz es: \n\n");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>EscribeDatos(Dimension,Inversa);</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>scanf("%d");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>return(0);</i><br />
<i>}</i><br />
<i><br /></i>
<i><br /></i>
<i>void PideDatos(int *Dim,float Sist[][Tam])</i><br />
<i>{</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>int A,B;</i><br />
<i> <span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n\n ||CALCULA INVERSA||");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n\n\n Introduce el tamano de la matriz:");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>scanf("%d",&*Dim);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n\n Introducir cada componente de la matriz A:");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>for(A=1;A<=*Dim;A++) for(B=1;B<=*Dim;B++){</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n Termino A(%d,%d):",A,B); scanf("%f",&Sist[A][B]);}</i><br />
<i>}</i><br />
<i><br /></i>
<i>void EscribeDatos(int Dim, float Sist[][Tam])</i><br />
<i>{</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>int A,B;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>for(A=1;A<=Dim;A++){</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>for(B=1;B<=(Dim);B++) printf("%7.2f",Sist[A][B]);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\n");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>}}</i><br />
<i><br /></i>
<i>void Invierte(int Dim, float Sist[][Tam], float Inv[][Tam])</i><br />
<i>{</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>int NoCero,Col,C1,C2,A;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>float Pivote,V1,V2;</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>/*Se inicializa la matriz inversa, como la matriz identidad:*/</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>for(C1=1;C1<=Dim;C1++) for(C2=1;C2<=Dim;C2++)</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span> if (C1==C2) Inv[C1][C2]=1; else Inv[C1][C2]=0;</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>for(Col=1;Col<=Dim;Col++){</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>NoCero=0;A=Col;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>while(NoCero==0){</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>if((Sist[A][Col]>0.0000001)||((Sist[A][Col]<-0.0000001))){</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>NoCero=1;}</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>else A++;}</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>Pivote=Sist[A][Col];</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>for(C1=1;C1<=Dim;C1++){</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>V1=Sist[A][C1];</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>Sist[A][C1]=Sist[Col][C1];</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>Sist[Col][C1]=V1/Pivote;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>V2=Inv[A][C1];</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>Inv[A][C1]=Inv[Col][C1];</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>Inv[Col][C1]=V2/Pivote;</i><br />
<i> }</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>for(C2=Col+1;C2<=Dim;C2++){</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>V1=Sist[C2][Col];</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>for(C1=1;C1<=Dim;C1++){</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>Sist[C2][C1]=Sist[C2][C1]-V1*Sist[Col][C1];</i><br />
<i> Inv[C2][C1]=Inv[C2][C1]-V1*Inv[Col][C1];}</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>}}</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>/*Aqui ya esta triangularizada, con 1s en diagonal, ahora se diagonaliza*/</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>for(Col=Dim;Col>=1;Col--) for(C1=(Col-1);C1>=1;C1--)</i><br />
<i> {</i><br />
<i> V1=Sist[C1][Col]; </i><br />
<i> for(C2=1;C2<=Dim;C2++){</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span> Sist[C1][C2]=Sist[C1][C2]-V1*Sist[Col][C2];</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span> Inv[C1][C2]=Inv[C1][C2]-V1*Inv[Col][C2];</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span> }}</i><br />
<i>}</i><br />
<i><br /></i>
<i><br /></i>
<i><br /></i>
<i><br /></i>
Un Saludo.Unknownnoreply@blogger.com20tag:blogger.com,1999:blog-1693174021147070350.post-26707503919242035292013-04-20T10:13:00.003-07:002013-04-20T10:13:48.782-07:00Lectura palabras entrecomilladas en C/C+Se guardan en fichero de texto todas las palabras entrecomilladas de un fichero de texto de entrada:<br />
<br />
<br />
<br />
<i>#include <stdio.h></i><br />
<i>#include <string.h></i><br />
<i><br /></i>
<i>int main(void)</i><br />
<i>{</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>FILE *dat,*dat2;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>char nombre[50],c;</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("Nombre del fichero a leer: "); scanf("%s", &nombre);</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>if (fopen(nombre,"r")==NULL) </i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\nEl fichero no existe.\n\n");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>else</i><br />
<i> {</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>dat=fopen(nombre,"r");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>dat2=fopen("salida.txt","w");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>fscanf(dat,"%c",&c);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>while (!feof(dat))</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>{</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>if (c=='"')</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>{</i><br />
<i> fscanf(dat,"%c",&c); </i><br />
<i> while ((!feof(dat))&&(c!='"'))</i><br />
<i> {</i><br />
<i> /*Aquí es donde se guardan los datos entre comillas*/</i><br />
<i> /*En este caso imprime en fichero de texto*/</i><br />
<i> fprintf(dat2,"%c",c);</i><br />
<i> fscanf(dat,"%c",&c); </i><br />
<i> }</i><br />
<i> fprintf(dat2,"\n"); </i><br />
<i> }</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>fscanf(dat,"%c",&c);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>}</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>fclose(dat);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>}</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("salio");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>getchar();</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>return 0;</i><br />
<i>}</i><br />
<div>
<br /></div>
<div>
<br /></div>
<div>
Un saludo.</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1693174021147070350.post-36906635779333702462013-04-18T15:12:00.001-07:002014-10-31T10:50:19.705-07:00Cifrado CESAR en C/C++Les presento el código del encriptador <b>CESAR</b>. Introducido un fichero de texto, genera un fichero con el mismo contenido, pero cifrado mediante este método. La información a cerca del cifrado se presenta en el encabezado del programa.<br />
Quiero recordar que en el blog hay disponible un tema sobre el mismo tipo de cifrado, pero en <a href="http://cypascal.blogspot.com.es/2012/10/cifrado-cesar.html">Pascal</a>, en vez de en C. Además también hay otro tipo de <a href="http://cypascal.blogspot.com.es/2012/02/codificar-fichero-de-texto.html">codificación</a> y <a href="http://cypascal.blogspot.com.es/2012/02/decodificar-texto.html">decodificación</a> que usa un método algo más complejo.<br />
Debido a la simplicidad de este método, el cifrado CESAR está actualmente en casi total desuso.<br />
<br />
Un poco de historia: El nombre de CESAR proviene de que según la historia, el primer personaje en usarlo fue Julio Cesar, con un desplazamiento de 3 letras, para comunicarse con los mandos del ejercito romano y no ser descubierto por personas ajenas a él.<br />
<br />
CÓDIGO:<br />
<br />
<br />
<br />
<br />
<i>/*CIFRADO CESAR EN C/C++*/</i><br />
<i><br /></i>
<i>/*Este programa se va a usar para llevar a cabo una codificación de un fichero</i><br />
<i>de texto, mediante el codificado CESAR, que es uno de los métodos más simples</i><br />
<i>de encriptar.</i><br />
<i>La variable trans==translación de encriptación, es la que indica cuantas letras</i><br />
<i>se va a correr el abecedario hacia la derecha. Ejemplo: </i><br />
<i> trans=3 </i><br />
<i> c1=Caracter decodificado</i><br />
<i> c2=Caracter codificado</i><br />
<i> c2=c1+trans</i><br />
<i> Entonces en nuestro caso si c1='A'</i><br />
<i> c2='A'+3='D'</i><br />
<i><br /></i>
<i>El programa solo codifica letras, tanto mayúsculas como minúsculas:</i><br />
<i>del ASCII 65 ('A') al 90 ('Z') y del 97 ('a') al 122 ('z').</i><br />
<i>*/</i><br />
<i><br /></i>
<i>#include <stdio.h></i><br />
<i>#include <string.h></i><br />
<i><br /></i>
<i>int main(void)</i><br />
<i>{</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>FILE *dat1,*dat2;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>char nombre1[50],nombre2[50],c;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>int trans;</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("Seleccione translacion de encriptacion: "); scanf("%d", &trans);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("Nombre del fichero a codificar: "); scanf("%s", &nombre1);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("Nombre del fichero donde guardar codificado: "); scanf("%s", &nombre2);</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>if (fopen(nombre1,"r")==NULL) </i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\nEl fichero no existe.\n\n");</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>else</i><br />
<i> {</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>dat1=fopen(nombre1,"r");/*Se abre en modo lectura*/</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>dat2=fopen(nombre2,"w");/*Se abre en modo escritura*/</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>fscanf(dat1,"%c",&c);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>while (!feof(dat1))</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>{</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>/*Se codifica el caracter*/</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>if ((c>='A')&&(c<='Z'))</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>{</i><br />
<i> c=((c+trans-'A')%('Z'-'A'+1))+'A'; </i><br />
<i> }</i><br />
<i> else if ((c>='a')&&(c<='z'))</i><br />
<i> {</i><br />
<i> c=(c+trans-'a')%('z'-'a'+1)+'a';</i><br />
<i> }</i><br />
<i> </i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>/*Se escribe el caracter en el codificado*/</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>fprintf(dat2,"%c",c);</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>/*Se lee un nuevo caracter*/</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>fscanf(dat1,"%c",&c);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>}</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>fclose(dat1);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>fclose(dat2);/*Se cierran ambos ficheros*/</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>}</i><br />
<i>}</i><br />
<i><br /></i>
<i><br /></i>
<i><br /></i>
<i><br /></i>
Y aquí un ejemplo de ejecución:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBc1H6LbKC1XgHlOKnuDtBbaf5SfI3VDY-2kgeBH7FHF6-s80zswUMuKRTLdMgLLIfHJYywdhKgzM5ZKZE5IlQp438RpbU0MZZOo-CyJ-fufAMV8iLkQr9F6x-HH4Beq-jHul9MYeXCrI/s1600/Captura.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBc1H6LbKC1XgHlOKnuDtBbaf5SfI3VDY-2kgeBH7FHF6-s80zswUMuKRTLdMgLLIfHJYywdhKgzM5ZKZE5IlQp438RpbU0MZZOo-CyJ-fufAMV8iLkQr9F6x-HH4Beq-jHul9MYeXCrI/s400/Captura.PNG" height="75" width="400" /></a></div>
<br />
<br />
<br />
<br />
Un saludo.Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-1693174021147070350.post-10395046990031525042013-04-18T08:46:00.002-07:002013-04-18T08:55:52.301-07:00Decodifcador VHDL (medidor de nivel, dec. 2:4)Descripción de un decodificar, que pasa de binario (2 bits) a barra de nivel (cuatro bits que pueden valer: 0000, 0001, 0011, 0111 o 1111). El Codificador/Decodificador (Dependiendo de la longitud de de sus entradas y salidas) es otro de los bloques básicos de electrónica digital.<br />
<br />
Aquí les dejo el código con el test bench y alguna captura:<br />
<br />
<br />
<i>use ieee.std_logic_1164.all;</i><br />
<i>use ieee.std_logic_unsigned.all;</i><br />
<i><br /></i>
<i>--Declaración de la entidad</i><br />
<i>entity decodificador is</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>port (E : in std_logic_vector (1 downto 0);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>EN: in std_logic; --Señal de habilitación</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>Y : out std_logic_vector (3 downto 0));</i><br />
<i>end decodificador;</i><br />
<i><br /></i>
<i>--Descripción comportamental</i><br />
<i>architecture behavior of decodificador is</i><br />
<i>begin</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>Y <= "0000" when (EN='0') else</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span> "0001" when (E="00") else</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span> "0011" when (E="01") else</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span> "0111" when (E="10") else</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span> "1111" when (E="11") else</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span> "1010"; --Para indicar error (No se debería dar este caso)<span class="Apple-tab-span" style="white-space: pre;"> </span></i><br />
<i>end behavior;</i><br />
<i><br /></i>
<i><br /></i>
<i><br /></i>
<i><br /></i>
<i><br /></i>
TEST BENCH:<br />
<i><br /></i>
<i>--TEST BENCH</i><br />
<i>--Declaración librerias</i><br />
<i>library ieee;</i><br />
<i>use ieee.std_logic_1164.all;</i><br />
<i>use ieee.std_logic_unsigned.all;</i><br />
<i><br /></i>
<i>entity testbench is</i><br />
<i>end testbench;</i><br />
<i><br /></i>
<i>architecture behavior of testbench is</i><br />
<i><br /></i>
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>--Declaración de la unidad bajo test (uut)</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>component decodificador</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>port (E : in std_logic_vector (1 downto 0);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>EN: in std_logic; --Señal de habilitación</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>Y : out std_logic_vector (3 downto 0));</i><br />
<i> end component;</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i> signal EN : std_logic:='0';</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>signal E : std_logic_vector (1 downto 0);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>signal Y : std_logic_vector (3 downto 0);</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>begin</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i> uut: decodificador port map (</i><br />
<i> E => E,</i><br />
<i> EN => EN,</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>Y => Y</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>);</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>--Se asignan valores a las señales de test</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>estimulo: process </i><br />
<i> begin</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>wait for 1 ns;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>EN <= '1'; wait for 10 ns;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>E <= "00"; wait for 10 ns;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>E <= "01"; wait for 10 ns;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>E <= "10"; wait for 10 ns;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>E <= "11"; wait for 10 ns;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>EN <= '0'; wait for 10 ns;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>E <= "00"; wait for 10 ns;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>E <= "01"; wait for 10 ns;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>E <= "10"; wait for 10 ns;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>E <= "11"; wait for 10 ns;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>end process estimulo;</i><br />
<i>end;</i><br />
<i><br /></i>
<i><br /></i>
<i><br /></i>
<i><br /></i>
<i><br /></i>
Capturas del cronograma:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzO9DFia0L36TYX_zsAzRs802wz-jo5mr0JYo89nC7BJAq_TDUHOC5x-gwPvwDJ0qptZ5aGf9ocJhIWKBP2XNPzES-Cr35XyoI1tASqsWyqHtNFPLivDq2lyWP15feUXBfzAwjSCwC0nM/s1600/desarrollada.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="121" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzO9DFia0L36TYX_zsAzRs802wz-jo5mr0JYo89nC7BJAq_TDUHOC5x-gwPvwDJ0qptZ5aGf9ocJhIWKBP2XNPzES-Cr35XyoI1tASqsWyqHtNFPLivDq2lyWP15feUXBfzAwjSCwC0nM/s640/desarrollada.PNG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjav-dOcz8WP6hIEmzD_msYH4Rtyhoo7KaQBMGCscnAvFhKToFPXJcm6Un42nVhnsaaSvYtObo4hOugesW-GQv1J3evGhGe7l1FA6YsGRMlcRSNZzo3IPz3JcF2aSOl-ps4_ebfDTm88P4/s1600/panoramica.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="62" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjav-dOcz8WP6hIEmzD_msYH4Rtyhoo7KaQBMGCscnAvFhKToFPXJcm6Un42nVhnsaaSvYtObo4hOugesW-GQv1J3evGhGe7l1FA6YsGRMlcRSNZzo3IPz3JcF2aSOl-ps4_ebfDTm88P4/s640/panoramica.PNG" width="640" /></a></div>
<br />
<br />
Un saludo.<br />
<i><br /></i>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1693174021147070350.post-63691005173280554412013-04-17T15:41:00.003-07:002013-04-18T07:49:28.912-07:00Multiplexor (Mux) VHDLEsta va a ser la primera entrada en la que tratemos el lenguaje VHDL. Lo primero que hay que dejar claro es que no se trata de un lenguaje de programación, sino que es un lenguaje descriptivo de dispositivos electrónicos. Este lenguaje nos permite simular sistemas electrónicos.<br />
<br />
A continuación se presenta la descripción y el banco de pruebas (test bench) de un multiplexor (mux) en VHDL, para ver si el funcionamiento de salida coincide con el teóricamente programado, cumpliendo la tabla de verdad del multiplexor.<br />
<br />
El esquema del multiplexor sería, con su tabla de verdad:<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMPXFxY0X4d0yiy-90PQm1HJKQlSiq2zJJgMiKoWP5CUNPVLRy5r2qZZIYD-rozSEQkwnRqCkdHB5fO74Gk6d_GKw254Jzj9_Q8pGqzflxhK-NCPwcKMsVIdGNVSwq0vIOzih-OVNPDe0/s1600/bloque.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMPXFxY0X4d0yiy-90PQm1HJKQlSiq2zJJgMiKoWP5CUNPVLRy5r2qZZIYD-rozSEQkwnRqCkdHB5fO74Gk6d_GKw254Jzj9_Q8pGqzflxhK-NCPwcKMsVIdGNVSwq0vIOzih-OVNPDe0/s200/bloque.png" width="199" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<b>S A B Y</b><br />
0 0 0 0<br />
0 0 1 0<br />
0 1 0 1<br />
0 1 1 1<br />
<br />
1 0 0 0<br />
1 0 1 1<br />
1 1 0 0<br />
1 1 1 1<br />
<br />
<br />
(Tabla de verdad)<br />
(Fundamento: La entrada 'S' es la que selecciona la entrada que va a ser la salida)<br />
<br />
Aquí el código<br />
<i><br /></i>
<i><br /></i>
<i>--Declaración de las librerias a usar</i><br />
<i>library ieee;</i><br />
<i>use ieee.std_logic_1164.all;</i><br />
<i><br /></i>
<i>--Declaración de la entidad</i><br />
<i>entity multiplexor is</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>port (A, B, S: in std_logic;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span> Y: out std_logic);</i><br />
<i>end multiplexor;</i><br />
<i><br /></i>
<i>--Descripción comportamental</i><br />
<i>architecture behavior of multiplexor is</i><br />
<i>begin</i><br />
<i> process(A, B, S)</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>begin</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span> if (S='1') then</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span> Y <= B;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>else</i><br />
<i> Y <= A;</i><br />
<i> end if;</i><br />
<i> end process;<span class="Apple-tab-span" style="white-space: pre;"> </span></i><br />
<i>end behavior;</i>:<br />
<br />
<br />
<br />
<br />
<br />
y aquí el test:<br />
<br />
<br />
<i>--Declaración librerias</i><br />
<i>library ieee;</i><br />
<i>use ieee.std_logic_1164.all;</i><br />
<i><br /></i>
<i>entity testbench is</i><br />
<i>end testbench;</i><br />
<i><br /></i>
<i>architecture behavior of testbench is</i><br />
<i><br /></i>
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>--Declaración de la unidad bajo test (uut)</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>component multiplexor</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>port (A, B, S: in std_logic;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span> Y: out std_logic);</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>end component;</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>signal A : std_logic:='0';</i><br />
<i> signal B : std_logic:='0';</i><br />
<i> signal S : std_logic:='0';</i><br />
<i> signal Y : std_logic:='0';</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>begin</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i> uut: multiplexor port map (</i><br />
<i> A => A,</i><br />
<i> B => B,</i><br />
<i> S => S,</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>Y => Y</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>);</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>--Se asignan valores a las señales de test</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>estimulo: process </i><br />
<i> begin</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>wait for 1 ns;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>A <= '0'; wait for 10 ns;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>B <= '1'; wait for 10 ns;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>S <= '1'; wait for 10 ns;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>A <= '1'; wait for 10 ns;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>B <= '0'; wait for 10 ns;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>S <= '0'; wait for 10 ns;</i><br />
<i><span class="Apple-tab-span" style="white-space: pre;"> </span>end process estimulo;</i><br />
<span class="Apple-tab-span" style="white-space: pre;"><i> </i></span><br />
<i>end;</i><br />
<br />
<br />
<br />
<br />
<br />
Y por último unas capturas del cronográma y del código:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOXnTKsxaF43RukDM-dN6Eyn2VMOi35TezsIzQLvTVy88RRDO88VAyeu-nB62qfNot1gpt8DfHNjfyPyVzleTXlmwlHIouhAD-NLzbKZVv6QnCfYLUnGyqSo9z4adv7gkfAK5kLXMXlTM/s1600/cod.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOXnTKsxaF43RukDM-dN6Eyn2VMOi35TezsIzQLvTVy88RRDO88VAyeu-nB62qfNot1gpt8DfHNjfyPyVzleTXlmwlHIouhAD-NLzbKZVv6QnCfYLUnGyqSo9z4adv7gkfAK5kLXMXlTM/s400/cod.PNG" width="400" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGJZauqRAimTI8p6w6HwayVJY2Jl0wwW7YmxfHNOa4fQHdIRaIuDb8K9xI62OBUvrJIA_Ygq5hnx60uR9GatRFY3kV5toFVUPqSAPxmDMHQVbOq9ev1Ml5jufKT9SbbGj6D81Xy5D-_U0/s1600/test.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGJZauqRAimTI8p6w6HwayVJY2Jl0wwW7YmxfHNOa4fQHdIRaIuDb8K9xI62OBUvrJIA_Ygq5hnx60uR9GatRFY3kV5toFVUPqSAPxmDMHQVbOq9ev1Ml5jufKT9SbbGj6D81Xy5D-_U0/s640/test.PNG" width="441" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiagfDETA0LPXx4hPk18Rl4beHHDa0ncgHExcpnej3xhSwwTpVHawpxUbdQ6I4WMmZBLyEUvV_PQEq5utv_6J9nbzDzPxQYyTaZ_V13-o-k4KL2xw73tSi9KX1SASRE2dQv1qtHbC-ICyE/s1600/crono.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="63" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiagfDETA0LPXx4hPk18Rl4beHHDa0ncgHExcpnej3xhSwwTpVHawpxUbdQ6I4WMmZBLyEUvV_PQEq5utv_6J9nbzDzPxQYyTaZ_V13-o-k4KL2xw73tSi9KX1SASRE2dQv1qtHbC-ICyE/s400/crono.PNG" width="400" /></a></div>
<br />
Para más información sobre multiplexores, uno de los bloques básicos de sistemas combinacionales, se puede consultar cualquier libro de electrónica digital. Las señales de simulación se pueden cambiar a vuestro antojo.<br />
<br />
Un saludo.<br />
<br />
<br />
<br />
<br />Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-1693174021147070350.post-41349852906494013862013-04-07T13:39:00.001-07:002013-05-11T12:32:17.918-07:00Determinante matriz en C/C++Cálculo del <b>determinante en C/C++ </b>mediante el uso de una función recursiva que se basa en el desarrollo de Laplace. Esta regla permite reducir el cálculo del determinante, al cálculo de sumas y productos. Este método no es ni mucho menos el más eficiente, debido a la función recursiva. Existen otros métodos, basados en la ortogonalización de matrices (Método de <a href="http://cypascal.blogspot.com.es/2012/02/obtencion-de-base-ortogonal-mediante.html">Gram-Smith (En Pascal)</a>) que permiten el cálculo numérico de una manera mucho más eficiente para el ordenador.<br />
<br />
Este programa ya fue <a href="http://cypascal.blogspot.com.es/2011/07/calculo-del-determinante.html">implementado en Pascal</a>, y ahora se ha implementado en C/C++. La limitación de este programa usando una función recursiva es evidente, y únicamente puede llegar a procesar matrices de 20x20.<br />
<br />
<br />
<br />
<i>/*CÁLCULA EL DETERMINANTE DE UNA MATRIZ EN C/C++*/</i><br />
<i><br /></i>
<i>#include <stdio.h></i><br />
<i><br /></i>
<i>int const max=11;</i><br />
<i>int vis;</i><br />
<i>float M[max+1][max+1]; /*EN LA POSICION 0,0 SE GUARDA LA DIMENSION DE M*/</i><br />
<i>float Det;</i><br />
<i><br /></i>
<i>float Determinante(float Mat[][max+1]);</i><br />
<i><br /></i>
<i>int main(void)</i><br />
<i>{</i><br />
<i> printf("\n\n CALCULO DEL DETERMINANTE DE UNA MATRIZ POR RECURSIVIDAD");</i><br />
<i> printf("\n\n CYPASCAL.BLOGSPOT.COM\n\n\n\n");</i><br />
<i> int cont1, cont2;</i><br />
<i> printf("Introduce el tamano de la matriz: "); scanf("%f", &M[0][0]);</i><br />
<i> for (cont1=1;cont1<=M[0][0];cont1++)</i><br />
<i> for (cont2=1;cont2<=M[0][0];cont2++){</i><br />
<i> printf("(%2i,%2i) ", cont1,cont2); </i><br />
<i> scanf("%f",&M[cont1][cont2]);</i><br />
<i> }</i><br />
<i> printf("Tamano: %f \n La matriz introducida es: \n",M[0][0]);</i><br />
<i> for (cont1=1;cont1<=M[0][0];cont1++){</i><br />
<i> for (cont2=1;cont2<=M[0][0];cont2++)</i><br />
<i> printf(" %5f", M[cont1][cont2]);</i><br />
<i> printf("\n");</i><br />
<i> }</i><br />
<i> printf("Visualizar matrices intermedias? (1=SI, 0=NO): ");scanf("%i",&vis);</i><br />
<i> Det=Determinante(M);</i><br />
<i> printf("El determiante de M vale: %f",Det);</i><br />
<i> scanf("%f",&Det);</i><br />
<i> return 0;</i><br />
<i>}</i><br />
<i><br /></i>
<i>float Determinante(float Mat[][max+1])</i><br />
<i>{</i><br />
<i> float aux1,aux2,Maux[max+1][max+1];</i><br />
<i> int cont1, cont2, cont3, cont4, cont5;</i><br />
<i> if (Mat[0][0]==1)</i><br />
<i> return (Mat[1][1]);</i><br />
<i> else</i><br />
<i> {</i><br />
<i> aux1=0;</i><br />
<i> aux2=1;</i><br />
<i> for (cont1=1; cont1<=Mat[0][0];cont1++)</i><br />
<i> {</i><br />
<i> Maux[0][0]=Mat[0][0]-1;</i><br />
<i> </i><br />
<i> for (cont2=1;cont2<=Mat[0][0];cont2++)</i><br />
<i> for (cont3=1;cont3<=Maux[0][0];cont3++){</i><br />
<i> if (cont2<cont1) </i><br />
<i> Maux[cont2][cont3]=Mat[cont2][cont3+1];</i><br />
<i> else if (cont2>cont1) </i><br />
<i> Maux[cont2-1][cont3]=Mat[cont2][cont3+1];</i><br />
<i> }</i><br />
<i> /*ESTOS DOS "FOR" SON PARA GENERAR MATRIZ ADJUNTA*/</i><br />
<i> if (vis==1){</i><br />
<i> printf("\n\n");</i><br />
<i> for (cont4=1;cont4<=Maux[0][0];cont4++){</i><br />
<i> for (cont5=1;cont5<=Maux[0][0];cont5++)</i><br />
<i> printf(" %5f", Maux[cont4][cont5]);</i><br />
<i> printf("\n");</i><br />
<i> }}/*SE IMPRIMEN EN PANTALLA LAS MATRICES INTERMEDIAS*/ </i><br />
<i> aux1=aux1+Mat[cont1][1]*aux2*Determinante(Maux);</i><br />
<i> aux2=aux2*(-1);/*ALTERNA 1 Y -1*/</i><br />
<i> }</i><br />
<i> return (aux1);</i><br />
<i>}}</i><br />
<i><br /></i>
<i><br /></i>
Un saludo.Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-1693174021147070350.post-48658806461411354822013-03-29T18:35:00.002-07:002014-10-31T10:51:08.946-07:00Biblioteca Grandes Números C/C++Una pequeña biblioteca en C/C++ (Comúnmente y mal conocida librería) que permite la suma y multiplicación de números con tantas cifras como se quiera. Los números se guardan en un array, guardando un dígito en cada una de sus componentes.<br />
<br />
En la cabecera van unas breves instruciones:<br />
<br />
<br />
<br />
<br />
<i><br /></i>
<i>/*BIBLIOTECA PARA OPERAR CON GRANDES NÚMEROS</i><br />
<i><br /></i>
<i>INSTRUCCIONES:</i><br />
<i><br /></i>
<i>En la posicion 0 del array se guarda su dimension.</i><br />
<i>Las cifras de indice menor, son las menos significativas. Ejemplo</i><br />
<i>A=002381;</i><br />
<i>A[0]=6; Dimesion</i><br />
<i>A[1]=0;</i><br />
<i>A[2]=0;</i><br />
<i>A[3]=2;</i><br />
<i>A[4]=3;</i><br />
<i>A[5]=8;</i><br />
<i>A[6]=1;</i><br />
<i><br /></i>
<i>Los datos con los que se opera deben tener la misma longitud, es decir</i><br />
<i>A[0]=B[0]</i><br />
<i><br /></i>
<i><br /></i>
<i>*/</i><br />
<i><br /></i>
<i>void multiplica(int A[], int B[], int C[]);</i><br />
<i>void suma(int A[], int B[], int C[]);</i><br />
<i>void Imprimir(int A[]);</i><br />
<i>void Leer(int A[]);</i><br />
<i><br /></i>
<i>void multiplica(int A[], int B[], int C[])</i><br />
<i>{</i><br />
<i> /*En C es donde se almacena la solucion*/</i><br />
<i> int cont1,cont2,acarreo,aux,aux2;</i><br />
<i> C[0]=A[0];</i><br />
<i> </i><br />
<i> for (cont1=A[0];cont1>=1;cont1--) C[cont1]=0;</i><br />
<i> aux=0;</i><br />
<i> </i><br />
<i> for (cont1=A[0];cont1>=1;cont1--)</i><br />
<i> {</i><br />
<i> acarreo=0;</i><br />
<i> for (cont2=A[0];cont2>=1;cont2--)</i><br />
<i> {</i><br />
<i> if ((cont2-aux)>0)</i><br />
<i> {</i><br />
<i> aux2=(C[cont2-aux]+A[cont1]*B[cont2]+acarreo)%10;</i><br />
<i> acarreo=(C[cont2-aux]+A[cont1]*B[cont2]+acarreo)/10;</i><br />
<i> C[cont2-aux]=aux2;</i><br />
<i> } </i><br />
<i> }</i><br />
<i> aux++;</i><br />
<i> }</i><br />
<i>}</i><br />
<i>void suma(int A[], int B[], int C[])</i><br />
<i>{</i><br />
<i> /*En C es donde se almacena la solucion*/</i><br />
<i> int cont,acarreo;</i><br />
<i> C[0]=A[0];</i><br />
<i> for (cont=A[0];cont>=1;cont--) C[cont]=0;</i><br />
<i> acarreo=0;</i><br />
<i> for (cont=A[0];cont>=1;cont--)</i><br />
<i> {</i><br />
<i> C[cont]=(A[cont]+B[cont]+acarreo)%10;</i><br />
<i> acarreo=(A[cont]+B[cont]+acarreo)/10;</i><br />
<i> }</i><br />
<i>}</i><br />
<i><br /></i>
<i>void Imprimir(int A[])</i><br />
<i>{</i><br />
<i> int cont;</i><br />
<i> for(cont=1;cont<=A[0];cont++) printf("%i",A[cont]);</i><br />
<i>}</i><br />
<i><br /></i>
<i>void Leer(int A[], int Tam)</i><br />
<i>{</i><br />
<i> int cont,aux;</i><br />
<i> char c;</i><br />
<i> </i><br />
<i> A[0]=Tam;</i><br />
<i> </i><br />
<i> printf("Escriba el numero: ");/*Se puede quitar*/</i><br />
<i> cont=0;</i><br />
<i> scanf("%c",&c);</i><br />
<i> while (c!='\n')</i><br />
<i> {</i><br />
<i> cont++;</i><br />
<i> A[cont]=c-'0';</i><br />
<i> scanf("%c",&c); </i><br />
<i> }</i><br />
<i> aux=cont;</i><br />
<i> for (cont=1;cont<=aux;cont++)/* printf("%i",A[cont]); printf("\n");*/</i><br />
<i> for (cont=0;cont<aux;cont++)</i><br />
<i> {</i><br />
<i> A[Tam-cont]=A[aux-cont];</i><br />
<i> A[aux-cont]=0;</i><br />
<i> }</i><br />
<i>}</i><br />
<i> </i><br />
<br />
<br />
También les dejo una calculadora que usa ambas funciones mostrando la suma y la multiplicación: (cabe resaltar la necesidad de llamar a la biblioteca)<br />
<br />
<br />
<i>#include <stdio.h></i><br />
<i>#include <grandes.h></i><br />
<i>const int max=50;</i><br />
<i><br /></i>
<i>int m[max+1],n[max+1],x[max+1];</i><br />
<i><br /></i>
<i>int main(void)</i><br />
<i>{</i><br />
<i> Leer(m,max);</i><br />
<i> Leer(n,max);</i><br />
<i> </i><br />
<i> suma(m,n,x);</i><br />
<i> printf("\n\nLa suma vale: "); Imprimir(x);</i><br />
<i> </i><br />
<i> multiplica(m,n,x);</i><br />
<i> printf("\n\nLa multiplicacion vale: "); Imprimir(x);</i><br />
<i> </i><br />
<i> scanf("%i");</i><br />
<i> return 0;</i><br />
<i>}</i><br />
<i><br /></i>
Por si lo necesitan, aquí les dejo el post donde se explica cómo se crean y se guardan las bibliotecas en C:<br />
<a href="http://cypascal.blogspot.com.es/2012/11/crea-tu-propia-biblioteca-en-cc.html">http://cypascal.blogspot.com.es/2012/11/crea-tu-propia-biblioteca-en-cc.html</a><br />
<br />
Un saludo.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<div>
<br /></div>
<div>
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-1693174021147070350.post-74450336538393769692013-03-29T09:24:00.002-07:002013-04-16T11:23:28.868-07:00Diferentes caminos en una malla (15 Segunda manera)Problema 15 Project Euler<br />
<br />
En respuesta al post: <a href="http://cypascal.blogspot.com.es/2013/03/problema-15-project-euler.html">http://cypascal.blogspot.com.es/2013/03/problema-15-project-euler.html</a>.<br />
Aquí les traigo una manera muchísimo más eficiente de calcularlo, no tarda ni 1 segundo.<br />
El mallado está representado por un array bidimensional, y en cada punto de este mallado se guardan el número de caminos que llegan. Este número se suma a las casillas adyacentes a ella, tanto a la derecha como por abajo, hasta que se llega a la última casilla.<br />
Las cantidades de caminos también se han representado con arrays, para evitar el desbordamiento.<br />
<br />
<br />
/*POR EL MÉTODO DE LOS CAMINOS*/<br />
<br />
<i>#include <stdio.h></i><br />
<i><br /></i>
<i>int const max=25;</i><br />
<i>int const dig=20;/*cantidad de digitos de la cifra de caminos*/</i><br />
<i><br /></i>
<i>int main(void)</i><br />
<i>{</i><br />
<i> int col, fil, TGrid, cif, aux;</i><br />
<i> int Grid[max][max][dig+1];</i><br />
<i> </i><br />
<i> printf("Introducir el tamano del tablero: "); scanf("%i",&TGrid);</i><br />
<i> </i><br />
<i> /*Inicializar Grid*/</i><br />
<i> for (col=0;col<=TGrid;col++) </i><br />
<i> for (fil=0;fil<=TGrid;fil++) </i><br />
<i> for (cif=0;cif<=dig;cif++) </i><br />
<i> Grid[fil][col][cif]=0;</i><br />
<i> </i><br />
<i> Grid[0][0][dig]=1;/*Casilla de inicio*/</i><br />
<i> </i><br />
<i> for (col=0;col<=TGrid;col++)</i><br />
<i> for (fil=0;fil<=TGrid;fil++)</i><br />
<i> { </i><br />
<i> if ((fil+1)<=TGrid)</i><br />
<i> for (cif=dig;cif>=0;cif--)</i><br />
<i> {</i><br />
<i> aux=(Grid[fil+1][col][cif]+Grid[fil][col][cif])%10;</i><br />
<i> Grid[fil+1][col][cif-1]=(Grid[fil+1][col][cif]+Grid[fil][col][cif])/10+Grid[fil+1][col][cif-1];</i><br />
<i> Grid[fil+1][col][cif]=aux;</i><br />
<i> }</i><br />
<i> if ((col+1)<=TGrid) </i><br />
<i> for (cif=dig;cif>=0;cif--)</i><br />
<i> {</i><br />
<i> aux=(Grid[fil][col+1][cif]+Grid[fil][col][cif])%10;</i><br />
<i> Grid[fil][col+1][cif-1]=(Grid[fil][col+1][cif]+Grid[fil][col][cif])/10+Grid[fil][col+1][cif-1];</i><br />
<i> Grid[fil][col+1][cif]=aux;</i><br />
<i> }</i><br />
<i> }</i><br />
<i> printf("El numero de caminos es: ");</i><br />
<i> for (cif=0;cif<=dig;cif++) printf("%i",Grid[TGrid][TGrid][cif]);</i><br />
<i> scanf("%i");</i><br />
<i> return 0;</i><br />
<i>}</i><br />
<i><br /></i>
Poniendo en el tamaño de grid 20, la solución es inmediata.<br />
Aquí las soluciones para los 50 primeros casos de mallados:<br />
<br />
<br />
<span style="font-family: inherit; font-size: x-small;"> 1 -00000000000000000000000000000000000000002</span><br />
<span style="font-family: inherit; font-size: x-small;"> 2 -00000000000000000000000000000000000000006</span><br />
<span style="font-family: inherit; font-size: x-small;"> 3 -00000000000000000000000000000000000000020</span><br />
<span style="font-family: inherit; font-size: x-small;"> 4 -00000000000000000000000000000000000000070</span><br />
<span style="font-family: inherit; font-size: x-small;"> 5 -00000000000000000000000000000000000000252</span><br />
<span style="font-family: inherit; font-size: x-small;"> 6 -00000000000000000000000000000000000000924</span><br />
<span style="font-family: inherit; font-size: x-small;"> 7 -00000000000000000000000000000000000003432</span><br />
<span style="font-family: inherit; font-size: x-small;"> 8 -00000000000000000000000000000000000012870</span><br />
<span style="font-family: inherit; font-size: x-small;"> 9 -00000000000000000000000000000000000048620</span><br />
<span style="font-family: inherit; font-size: x-small;"> 10 -00000000000000000000000000000000000184756</span><br />
<span style="font-family: inherit; font-size: x-small;"> 11 -00000000000000000000000000000000000705432</span><br />
<span style="font-family: inherit; font-size: x-small;"> 12 -00000000000000000000000000000000002704156</span><br />
<span style="font-family: inherit; font-size: x-small;"> 13 -00000000000000000000000000000000010400600</span><br />
<span style="font-family: inherit; font-size: x-small;"> 14 -00000000000000000000000000000000040116600</span><br />
<span style="font-family: inherit; font-size: x-small;"> 15 -00000000000000000000000000000000155117520</span><br />
<span style="font-family: inherit; font-size: x-small;"> 16 -00000000000000000000000000000000601080390</span><br />
<span style="font-family: inherit; font-size: x-small;"> 17 -00000000000000000000000000000002333606220</span><br />
<span style="font-family: inherit; font-size: x-small;"> 18 -00000000000000000000000000000009075135300</span><br />
<span style="font-family: inherit; font-size: x-small;"> 19 -00000000000000000000000000000035345263800</span><br />
<span style="font-family: inherit; font-size: x-small;"> 20 -00000000000000000000000000000137846528820</span><br />
<span style="font-family: inherit; font-size: x-small;"> 21 -00000000000000000000000000000538257874440</span><br />
<span style="font-family: inherit; font-size: x-small;"> 22 -00000000000000000000000000002104098963720</span><br />
<span style="font-family: inherit; font-size: x-small;"> 23 -00000000000000000000000000008233430727600</span><br />
<span style="font-family: inherit; font-size: x-small;"> 24 -00000000000000000000000000032247603683100</span><br />
<span style="font-family: inherit; font-size: x-small;"> 25 -00000000000000000000000000126410606437752</span><br />
<span style="font-family: inherit; font-size: x-small;"> 26 -00000000000000000000000000495918532948104</span><br />
<span style="font-family: inherit; font-size: x-small;"> 27 -00000000000000000000000001946939425648112</span><br />
<span style="font-family: inherit; font-size: x-small;"> 28 -00000000000000000000000007648690600760440</span><br />
<span style="font-family: inherit; font-size: x-small;"> 29 -00000000000000000000000030067266499541040</span><br />
<span style="font-family: inherit; font-size: x-small;"> 30 -00000000000000000000000118264581564861424</span><br />
<span style="font-family: inherit; font-size: x-small;"> 31 -00000000000000000000000465428353255261088</span><br />
<span style="font-family: inherit; font-size: x-small;"> 32 -00000000000000000000001832624140942590534</span><br />
<span style="font-family: inherit; font-size: x-small;"> 33 -00000000000000000000007219428434016265740</span><br />
<span style="font-family: inherit; font-size: x-small;"> 34 -00000000000000000000028453041475240576740</span><br />
<span style="font-family: inherit; font-size: x-small;"> 35 -00000000000000000000112186277816662845432</span><br />
<span style="font-family: inherit; font-size: x-small;"> 36 -00000000000000000000442512540276836779204</span><br />
<span style="font-family: inherit; font-size: x-small;"> 37 -00000000000000000001746130564335626209832</span><br />
<span style="font-family: inherit; font-size: x-small;"> 38 -00000000000000000006892620648693261354600</span><br />
<span style="font-family: inherit; font-size: x-small;"> 39 -00000000000000000027217014869199032015600</span><br />
<span style="font-family: inherit; font-size: x-small;"> 40 -00000000000000000107507208733336176461620</span><br />
<span style="font-family: inherit; font-size: x-small;"> 41 -00000000000000000424784580848791721628840</span><br />
<span style="font-family: inherit; font-size: x-small;"> 42 -00000000000000001678910486211891090247320</span><br />
<span style="font-family: inherit; font-size: x-small;"> 43 -00000000000000006637553085023755473070800</span><br />
<span style="font-family: inherit; font-size: x-small;"> 44 -00000000000000026248505381684851188961800</span><br />
<span style="font-family: inherit; font-size: x-small;"> 45 -00000000000000103827421287553411369671120</span><br />
<span style="font-family: inherit; font-size: x-small;"> 46 -00000000000000410795449442059149332177040</span><br />
<span style="font-family: inherit; font-size: x-small;"> 47 -00000000000001625701140345170250548615520</span><br />
<span style="font-family: inherit; font-size: x-small;"> 48 -00000000000006435067013866298908421603100</span><br />
<span style="font-family: inherit; font-size: x-small;"> 49 -00000000000025477612258980856902730428600</span><br />
<span style="font-family: inherit; font-size: x-small;"> 50 -00000000000100891344545564193334812497256</span><br />
<div>
<br /></div>
<br />
<br />
<br />
Un saludo.Unknownnoreply@blogger.com0