Skip to content

Instantly share code, notes, and snippets.

@l337quez
Last active April 18, 2016 13:26
Show Gist options
  • Save l337quez/915df8d35b3b9675230b6750cbe45850 to your computer and use it in GitHub Desktop.
Save l337quez/915df8d35b3b9675230b6750cbe45850 to your computer and use it in GitHub Desktop.
script para crear matrices
function pruebamatriz (k)
function [ ] = CorrerProyecto()
%*************************************************
%Matriz 4x4 numeros del 0 al 15
%*************************************************
if (k==1)
for j= 1 : 4 %columnas
for i= 1 : 4 %Filas
a(j, i) = i+4*j-5;
end
end
a
end %
%*************************************************
%Matriz 4x4 numeros del 0 al -15
%*************************************************
if (k==2)
for j= 1 : 4 %columnas
for i= 1 : 4 %Filas
a(j, i) = -(i+4*j-5);
end
end
a
end
%*************************************************
%Matriz 4x4 unitaria
%*************************************************
if (k==4)
for j= 1 : 4 %columnas
for i= 1 : 4 %Filas
a(j, i) = 1;
end
end
a
end
%*************************************************
%Matriz 3x3 Diagonal unitaria
%*************************************************
if (k==5)
for j= 1 : 3 %columnas
for i= 1 : 3 %Filas
if j==2 && i==1
a(i, j) = 0;
elseif j==3 && i==1
a(i, j) = 0;
elseif j==3 && i==2
a(i, j) = 0;
elseif j==1 && i==2
a(i, j) = 0;
elseif j==1 && i==3
a(i, j) = 0;
elseif j==2 && i==3
a(i, j) = 0;
else
a(i, j) = 1;
end
end
end
end
end %fin de la funcion correrproyecto
CorrerProyecto
end %function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment