Last active
April 18, 2016 13:26
-
-
Save l337quez/915df8d35b3b9675230b6750cbe45850 to your computer and use it in GitHub Desktop.
script para crear matrices
This file contains hidden or 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
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