Social Icons

twitterfacebookgoogle plusemail

jueves, 22 de noviembre de 2012

Problema de laboratorio

P2.16.  Obténgase un grafo de flujo de señal para representar el siguiente conjunto de ecuaciones algebraicas donde yse consideran las variables dependientes y 6 y 11 son las
entradas:


Determínese el valor de cada variable dependiente usando la fórmula de la ganancia. Después, resuélvase para  mediante mediante la fórmula de ganancia del flujo de señal de Mason y verifíquese la solución usando la regla de Cramer.

Grafo de flujo de señal:

Ganancia del flujo de señal:



Regla de Cramer:







lunes, 19 de noviembre de 2012

Reporte de Proyecto

Introducción

Para el reporte de la entrega final de proyecto explicaré denuevo de que trata mi proyecto, la idea del proyecto fue hacer una red neuronal que por medio de unos electrodos en el antebrazo de una persona determine los movimientos que quiere realizar en el brazo, esto se puede por medio de frecuencias que manda el cerebro hacia el brazo, y lo que se busca es interceptar esas frecuencias en el antebrazo para poder controlar un brazo robótico.

Al final se optó por usar un EEG debido a problemas con la Aduana al creer que los eléctrodos del sensor de músculo se podían tomar.


Donde podemos ver en la imagen de lado derecho separado por comas lo siguiente: "Intensidad de señal, atención, meditación, delta, theta, low alpha, high alpha, low beta, high beta, low gamma, high gamma".

Componentes

Los componentes que se usaron en el proyecto son los siguientes:

Arduino

EEG

Brazo robótico

MotorShield


¿ Cómo funciona?

Primero se toman las entradas del EEG para que luego sean preprocesadas, en el preprocesamiento se limpian los valores que nos importan donde mala intensidad de señal se ignora.

Al final obtenemos los valores que nos importan que son 10 entradas ignorando la intesidad de señal del EEG, estos valores irán dentro de una lista que entrarán a nuestra red neuronal la cual nos devolverá una salida binaria (1 ó 0) donde 1 hará que el brazo se mueva hacía la derecha y 0 que el brazo se mueva hacía la izquierda, esto ocurre gracias a que se establece una comunicación por medio del puerto serial y cuando se establece la comunicación este podrá recibir los valores antes mencionados, según los datos procesados.



Movimiento del brazo

El motor DC del brazo a controlar se mueve de 0 a 180 grados y de 180 a 0 grados osea derecha o izquierda. Para tomar el valor de la posición del brazo se utilizaron potenciómetros que fueron colocados a lado del motor DC para que nos digan por medio de ellos en que posición se encuentran.





Código del arduino:
Código del preprocesamiento:


Código de prueba de comunicación con arduino:


Control de versiones

jueves, 15 de noviembre de 2012

Reporte de laboratorio 6

B.12.2. Sea el sistema definido por


donde


Transforme las ecuaciones del sistema en la forma canónica observable.

1. Se tiene el planteamiento del problema original (1.1) y (1.2).

2. Se crea la función de transferencia del sistema de control (2).

3. Se crea la forma normal controlable apartir de su función de transferencia (3.1) y (3.2).

4. Se hace la transpuesta de la forma normal controlable y cambio de variables de B a C 
y de C a B, esto se hace para obtener la forma normal observable (4.1) y (4.2).

5. Al final verificamos que haya sido la misma función de transferencia(5).


Código en Octave:
El uso del código en octave y la verificación de que sean equivalente las funciones de tranferencia de cada forma usada:

Fuentes de ayuda:
http://www.engr.mun.ca/~millan/6825/canonicals.pdf

martes, 13 de noviembre de 2012

Reporte grupal sobre propiedades estructurales

Introducción

El sistema que se pretende controlar es el mismo que se tiene como proyecto final de esta materia. Para ello daré una breve explicación, mi proyecto trata de mover una pelota a cierta altura en el aire dentro de un tubo donde este será movido por un ventilador con un motor DC, gracias a un sensor ultrasonico este sabría hacia que altura moverse, osea que tanta potencia le daríamos al motor DC para que la pelota se eleve. Para ello reciclaremos el juguete que vemos abajo, conectando el motor DC y el sensor ultrasonico a un arduino que por medio de este haremos el control.

Reporte
Esta es su representación en la forma normal controlable.
Código en Octave:

Esta es su representación en la forma normal observable.
Código en Octave:

Esta es su representación en la forma de Jordan.
Código en Octave:

Código en Latex del documento:



Personas del equipo:

Saúl Gausin
Raúl Gonzalez
Isaías Garza

martes, 6 de noviembre de 2012

Problema 14.1 y 14.1.1

14.1 If a professor forgets coins or drink at the machine, there inmediately will be a student who will come to the machine.


Where P equivale a maestro, fcoin equivale si el maestro olvida monedas y fdrink si el maestro olvida bebida y SC equivale a que el estudiante vendrá.

14.1.1 If the beer storage becomes empty, it gets rechanged inmediately.


Donde BE equivale a almacenamiento vacío de cerveza y R es rechanged.

jueves, 1 de noviembre de 2012

Problema de laboratorio

B.5.20. Obtenga la respuesta a una rampa unitaria del sistema definido por



donde u es una entrada rampa unitaria. Utilice el comando lsim para obtener la respuesta.

Código:


Gráfica:

martes, 30 de octubre de 2012

Estabilidad del proyecto

Para realizar el proyecto, uno de los pasos importantes es verificar que nuestro sistema tenga estabilidad y para ello una manera de ver e identificar que nuestro sistema es realmente estable se pueden realizar distintos diagramas tales como diagrama de bode, respuesta y nyquist.

Primero veremos algo del código del cual es relativamente corto, con la ayuda de la librería de control se usaron las funciones para dibujar y representar la función de transferencia.

Recordando que nuestra función de transferencia es la siguiente:

Ahora veamos los diagramas que nos dio nuestro programa.

Diagrama de bode:
 Diagrama de respuesta:


Diagrama de nyquist:

Conclusión

Tomando en cuenta la teoría de las definiciones del libro de control que se lleva en la materia, se puede decir que nuestro sistema es estable debido a que cumple con las siguientes características nuestro sistema en los diagramas anteriores, cumplen con un ligero cambio y no sufre de cambios bruscos, ademas los diagramas de respuesta cumplen con lo deseado, ya que la respuesta que se espera es ligero y no brusco. Basandome en una presentación donde muestra un sistema parecido me di cuenta que nuestro sistema cumple con algunas características típicas cuando se hace control de un motor dc.

Sistema de Transiciones: Elevador

A continuación veremos mi sistema de transiciones que consiste en un elevador y una puerta, basandome en la entrada anterior en donde modele el mismo sistema hice el sistema de transiciones en donde también se corrigieron unos errores cometidos en el modelo de la red petri en donde nunca regresaba a un estado inicial.


Y este es el código que hice en promela basandome en la explicación de las diapositivas que dejaré debajo.


Fuente:
Diapositivas de promela.

domingo, 28 de octubre de 2012

Steganography Assignment

Here's my code in three of the six photos. I recommend to download these photos from the link below because blogspot changes something and it's difficult to recover the information.


After the deadline, I'm going to explain how my algorithm works.
Happy hack :)

 







Parameters to encrypt:

1.- Name of the text to encrypt
2.- The image to hide the message
3.- The name of the image with the message

Example:

imagenes.py photo8.bmp copia8.bmp

Parameters to decrypt:

1.- Name of the image with the message
2.- The file to put the message
3.- The keyword "decripta"

Example: 

copia6.bmp recuperado6.dat decripta

Código


**Note** The three images with message are the number 1, 3 and 5.

jueves, 25 de octubre de 2012

Stream ciphers: Trivium


What is Trivium?

Trivium is a hardware oriented synchronous stream cipher, that was designed as an exercise in exploring how far a stream cipher can be simplified without sacrificing its security, speed or flexibility. 

Trivium is a synchronous stream cipher designed to generate up to 2 ^64 bits of key stream from an 80-bit secret key and an 80-bit initial value (IV), the process consists of two phases: first the interntal state of the cipher is initialized using the key and the IV, then the state is repeatedly updated and used to generate key stream bits. These are the parameters:

Key size: 80 bit
IV size: 80 bit
Internal state: 288 bit

Who invented Trivium?

It was submitted to a eSTREAM competition by its authors, Christophe De Cannière and Bart Preneel, and has been selected as part of the portfolio for low area hardware ciphers by the eSTREAM project, It's not patented.

How does It work?

Key stream generation; The proposed design contains a 288-bit internal state denoted by (s 1, ..., s 288). The key stream generation consists of an iterative process which extracts the values of 15 specific state bits and uses them both to update 3 bits of the state and to compute 1 bit of key stream z i. The state bits are then rotated and the process repeats itself until the requested N <= 2 ^64 bits of keys stream have been generated. Here is a pseudo-code:
Where "+" and "." operations stand for addition and multiplication over GF(2), which is the Galois Field of two elements (XOR and AND).

Key and IV setup; the algorithm is initialized by loading an 80-bit key and an 80-bit IV into the 288-bit initial state, and setting all remaining bits to 0, except for s ^286, s ^287 and 2 ^288, then the state is rotated over 4 full cycles without generating key stream bits.




Implementation  

Trivium is a hardware oriented design focussed on flexibility; It aims to be compact in environments with restrictions on the gate count, faster in applications that needs high-speed encryption and limited power resources. The design must provide a way to parallelize its operations, Trivium did it by ensuring any state bit that is not used for at least 64 iterations after it has been modified. This way, up to 64 iterations can be computed at once, provided that the 3 AND gates and 11 XOR gates in the original scheme are duplicated a corresponding number of times. This allows the clock frequency to be divided by a factor 64 without a ecting the throughput.

Attacks known

There are some attacks known as you can see below:

Source:

Article where you can see specifications. 

martes, 23 de octubre de 2012

Redes Petri: Elevador

El sistema que modele fue el de un elevador, en donde lo separé en dos componentes: Puerta y Elevador, en donde Puerta tiene como estados Abierto y Cerrado en el cual como el nombre lo dice en el estado Abierto abre la puerta del elevador y Cerrado cierra la puerta de la misma, como transiciones tenemos una comparación de unas variables boleanos donde verifica si el elevador le manda la señal de ascender o descender, en donde sí recibe un valor verdadero este mantiene cerrada la puerta. En Elevador tenemos 4 estados Inicio, Subir, Bajar y Detener, donde Inicio es cuando el elevador esta por usarse y nos envía la variable Piso según el piso elegido a una transición Piso > Actual ó Piso < Actual, el cual la primera irá hacía Subir y la segunda hacía Bajar todo esto hasta que Piso sea igual al Actual para entrar a el estado Detener.

Redes Petri:



Código:



jueves, 18 de octubre de 2012

Galois/Counter Mode(GCM)

What is GCM?

GCM is a block cipher mode of operation providing both confidentiality and data origin authentication; It is defined for block ciphers with block sizes of 128, 192 and 256 bits.  Galois Message Authentication Code (GMAC) is an authentication-only variant of the GCM which can be used as an incremental message authentication code. Both GCM and GMAC can accept initialization vectors of arbitrary length.

Who invented GCM?

GCM was designed by McGrew and Viega as an improvement to Carter-Wegman Counter CWC mode. On November 26, 2007 NIST announced the release of NIST Special Publication Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC making GCM and GMAC official standards.

These are the Inputs and Outputs for GCM system

GCM has two operations, authenticated encryption and authenticated decryption, where the authenticated encryption has four inputs, and each of which is a bit string:

- A secret key K, whose length depends of the block cipher use.

- An initialization vector IV, that can have any number of bits between 1 and 2 ^64. For a fixed value of the key, each IV value must be distinct. If you are looking for efficiency is recommended 96-bit IV values.

- A plaintext P, which can have any number of bits between 0 and 2 ^39 -256.

- Additional authenticated data (AAD), which is denoted as A, this data is authenticated, but not encrypted, and can have any number of bits between 0 and 2 ^64.

There are two outputs:

- A ciphertext C whose length is exactly that of the plaintext P.

- An authentication is denotated as T, whose length can be any value between 0 and 28. The length is denotated as t.

How does It work?

First we have to know the notation

The two main functions used in GCM are block cipher encryption and multiplication over the field GF(2 ^128). The block cipher encryption of the value X with the key K is denoted as E(K, X). The multiplication of two elements X, Y ∈ GF(2 ^128) is denoted as X · Y , and the addition of X and Y is denoted as X ⊕ Y . A, the addition in this field is equivalent to the bitwise exclusive-or operation.

The function len() returns a 64-bit string containing the nonnegative integer describing the number of bits in its argument, with the least significant bit on the right. The expression 0l denotes a string of l zero bits, and AkB denotes the concatenation of two bit strings A and B. The function MSBt(S) returns the bit string containing only the most significant (leftmost) t bits of S, and the symbol {} denotes the bit string with zero length.

Now Let's know how it works... 

Encryption

Let n and u denote the unique pair of positive integers such that the total number of bits in the plaintext is (n − 1) 128 + u, where 1 ≤ u ≤ 128.

The plaintext consists of a sequence of n bit strings, in which the bit length of the last bit string is u, and the bit length of the other bit strings is 128. The sequence is denoted P 1, P 2, ...,P n-1, P ∗ n, and the bit strings are called data blocks, although the last bit string, P ∗ n, may not be a complete block. Similarly, the ciphertext is denoted as C 1, C 2,...,C n − 1 ,C ∗ n, where the number of bits in the final block C ∗ n is u. The additional authenticated data A is denoted as A 1, A 2,..., A m − 1, A ∗ m, where the last bit string A ∗ m may be a partial block of length v, and m and v denote the unique pair of positive integers such that the total number of bits in A is (m − 1) 128 + v and 1 ≤ v ≤ 128.

The authenticated encryption operation is defined by the following equations:

Successive counter values are generated using the function incr(), which treats the rightmost 32 bits of its argument as a nonnegative integer with the least significant bit on the right, and increments this value modulo 2 ^32. More formally, the value of incr(F||I) is F||(I + 1 mod 2 ^32).

The function GHASH is defined by GHASH(H,A,C) = X m + n + 1, where the inputs A and C are defined as we defined in the beginning, and the variables X i for i = 0,...,m + n + 1 are defined below:


Below we can see the process of encryption.

Decryption

The authenticated decryption operation is similar to the encrypt operation, but with the order of the hash step and encrypt step reversed, as you can see below how it works by the following ecuations:

T ' is computed by the decryption operation, and is compared to T associated with the ciphertext C, if the two values match in length and value, the ciphertext is returned.

 Multiplication in GF(2 ^128)

The multiplication operation is defined as an operation on bit vectors in order to simplify the specification, this  corresponds to the particular field representation used in GCM. Each element is a vector of 128 bits, the i th bit of an element X is denoted as X i; The leftmost bit is X 0, and the rightmost bit is X 127. 

The multiplication operation uses the special element R = 11100001 || 0 ^120; The function rightshift() moves the bits of its argument one bit to the right, in other words whenever W = rightshift(V), then W i = V i-1 for 1 ≤ i ≤ 127 and W 0 = 0. We can see it illustrated below.


The Field GF(2 ^128)

A finite field is defined by its multiplication and addition operations. These operations obey the basic algebraic properties that one expects from multiplication and addition (commutativity, associativity, and distributivity). Both operations map a pair of field elements onto another field element. In a polynomial basis,the multiplication of two elements X and Y consists of multiplying the polynomial representing X with the polynomial representing Y, then dividing the resulting 256-bit polynomial by the field polynomial; the 128-bit remainder is the result. GCM uses the following polynomial:


The addition of two elements X and Y consists of adding the polynomials together, because each coefficient is added independently, and the coefficients are in GF(2), this operation is identical to the bit wise exclusive-or of X and Y. No reduction operation is needed. Subtraction over GF(2 ^128) is identical to addition, because the field GF(2) has that property.

Attacks known

I find some information about his weaknesses in the GMAC (Galois Message Authentication Code), well actually this is a common weak in all kind of encryption or decryption that needs a key. You have to use a value relative prime.

Sources:



Problema de laboratorio

B.6.7 Dibuje los lugares de los raices para un sistema de control en lazo cerrado con:


Comandos en Octave usando la librería control:



Donde la función tf nos ayuda a crear o convertir un modelo de una función de transferencia, rlocus nos ayuda a graficar nuestro sistema en "lugar de raíces".

Dibujado:



martes, 16 de octubre de 2012

Lógica predicativa: Red Wireless

En esta entrada hablaremos sobre teoría de grafos aplicada en lógica de primer orden, para ello nos enfocaremos en redes wireless para reducir las interferencias en las redes wireless.

El problema de reducir la interferencia en redes resulta ser muy difícil, y por esta razón, se han investigado diseños de topologías talescomo, multi-hop, red triangular, la unidad gráficos de disco, hexagonal, entre otros.

Los aspectos clave del problema de interferencia en las redes inalámbricas podría ser una solución artificial en un entorno distribuido o centralizado, hace unos pocos meses salió a la luz una investigación que realizaron unos científicos de la Universidad de Catalunya sobre el canto que realizaban unas ranas macho donde ellos los realizan poder atraer a las hembras así reconocen el origen de la llamada y localizan al pretendiente, el problema surge cuando dos machos están demasiado cerca y cantan a la vez.


Las hembras quedan confundidas y no pueden determinar de donde proceden las llamadas, por lo que los machos han tenido que aprender a desincronizar sus cantos. El objetivo de esta investigación es realizar un sistema inteligente que realize el comportamiento de las ranas para que esto ayude a hacer operaciones distribuidas.

Una de las cosas que más se realizan son simulaciones donde se pueden trazar los metros cuadrados donde se piensa implementar el sistema y dejar que el sistema haya lo suyo donde tome como parámetros las propiedades de las antentas y la cantidad de ellas.

Fuentes:
http://www.agenciasinc.es/Noticias/El-canto-de-una-rana-inspira-un-algoritmo-para-redes-inalambricas

martes, 9 de octubre de 2012

Diagrama de bloques

Para esta entrada hablaremos sobre el diagrama de bloques en nuestro proyecto, en sí el proyecto consiste en mover una pelota a cierta altura en el aire dentro de un tubo donde este será movido por un ventilador con un motor DC, gracias a un sensor ultrasonico este sabría hacia que altura moverse, osea que tanta potencia le daríamos al motor DC para que la pelota se eleve. Para ello reciclaremos el juguete que vemos abajo, conectando el motor DC y el sensor ultrasonico a un arduino que por medio de este haremos el control.


Fuente de la imágen: http://maxkalavera.blogspot.mx/2012/10/diagramas-de-bloque-yo-flujo-de-senales.html

Una vez explicado lo anterior procederemos al diagrama de bloques: