This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%Guardar un vector en Variables | |
a=[2 3]; | |
b=a(1); | |
c=a(2); | |
% Por lo tanto el primer campo del vector sera asignado a la | |
%variable "a" y el segundo campo a la variable "b" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%Si queiremos saber cuantos campos tiene un vector, para luego | |
%guardar el vector en varias variables | |
%dado el vector v=[0 2 5 3 6 7 8]; | |
v=[0 2 5 3 6 7 8]; | |
%para conocer el tamaño del vector usamos el comando size() | |
size(v) | |
ans = | |
1 7 | |
%vemos que el resultado del tamaño nos dice que hay 7 campos | |
%0 2 5 3 6 7 8 = 7 campos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%otra forma de guardar el tamaño del vector | |
>> r=[5 3 -5]; | |
%guardando el primer campo del vector | |
>> r(1) | |
ans =5 | |
%guardando el tamaño del vector | |
>> r(end) | |
ans =-5 | |
>> length(r) | |
ans = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%GUARDAR PARTE DE UN VECTOR EN OTRA VARIABLE | |
>> v=[4 10 -3 7 -1 ]; | |
>> u=v(2:4) | |
u = 10 -3 7 | |
%AÑADIR ELEMENTOS A UN VECTOR | |
>>v=1:4 | |
v = | |
1 2 3 4 | |
%decimos que comience agregar numeros despues del ultipo campo lleno | |
%que es 4 y que llene hasta 10 campos, despues del ultimo campo lleno |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%Se tiene un vector llamado VECTOR y guardaremos en diferentes variables cada uno de sus campos | |
VECTOR = ['America';'Europa';'Asia']; | |
variable1=vector(1,:), % Asignanamos 'America' a variable1 | |
variable2=vector(2,:), % Asignanamos 'Europa' a variable2 | |
variable3=vector(3,:), % Asignanamos 'Asia' a variable3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%Graficar una funcion de Transferencia con tiempo muerto | |
%definimos la funcion de transferencia | |
funcion=tf([12],[1 +1]) | |
% hicimos que el numerador (ganancia)=12 | |
%y el denominador sea S+1, lo que se coloca son los coeficientes | |
%ingresamos el tiempo muerto, en este caso 0.5 | |
funcion.OutputDelay=0.5 | |
%graficamos la funcion de transferencia con el tiempo muerto | |
step(funcion) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%definimos los limites | |
menor=550; | |
mayor=680; | |
%creamos un vector usando el comando rand | |
%rand(1,5); crea un vetor con 5 columnas y 1 fila | |
vector = menor + (mayor-menor).*rand(1,5); | |
%el vector creado esta desordenado, lo arreglamos ascendente | |
Vector= sort(vector); | |
%necesitamos el vector como columna | |
H1=Vector' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Typiar el comando gude y crear un objeto uitable, luego se puede crear un boton que guarde la data | |
% hacemos click derecho al boton y le damos click en callback | |
%el comando get para obtener lo que tiene el objeto | |
ObtenerDatos=get(handles.uitable1,'data'); | |
%para conocer la dimencion de la Matriz usamos size | |
n=size(ObtenerDatos,1); | |
% Creamos un archivo.dat con permisos de escritura 'w' | |
archivo=fopen('datos.dat','W'); | |
%llenamos la matriz usando un For |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RPI.GPIO as GPIO | |
import time | |
#definimos la funcion blind | |
def blink(pin): | |
GPIO.output(pin,GPIO.HIGH) | |
time.sleep(1) | |
GPIO.output(pin,GPIO.LOW) | |
time.sleep(1) | |
return | |
#Para usar los pines de la tarjeta Raspberry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%Creado por Ronal Forero | |
%Programa del metodo de Newton Raphson | |
clc, clear %limpiamos pantalla, limpiamos workspace | |
fprintf('\n Nota:Ingrese el plinomio como un vector. \n') | |
fprintf('\n Ejemplo: x^3 + 4x^2 + 7x + 9 => [1 4 7 9] \n') | |
pol=input('\nIngrese el polinimoio:'); | |
size=size(pol); | |
tamano=size(2); |
OlderNewer