Skip to main content

Gauss C++ (codigo)


% A es la matriz de coeficientes
% b es el vector de terminos independientes
% x es el vector solucion
% n es el orden del sistema

[n,m] = size(A);

% eliminacion
for i=1:n
  for k=i+1:n
    factor = (A(k,i)/A(i,i));
    A(k,i:n) = A(k,i:n) - factor*A(i,i:n);
    b(k) = b(k) - factor*b(i);
  end
end

%sustitucion inversa
x = zeros(1,n);
x(n) = b(n)/A(n,n);
for k=n-1:-1:1
  x(k) = (b(k) - sum(x(k+1:n).*A(k,k+1:n)))/A(k,k);
end
x

Comments

Popular posts from this blog

Renovar direccion IP con un Batch

Abrir un Bloq de notas en la siguiente direccion: Start > Run > notepad (Enter) Inicio > Ejecutar > notepad (Enter) Win + R > notepad (Enter) en el bloque de notas o Notepad escribir lo siguiente: echo off  cls  ipconfig /release  ipconfig /renew  ipconfig /registerdns  exit guardar el archivo como RenovarIP.bat o RenewIP.bat en la extension seleccionar todos los archivos en ves de TXT para que el archivo se guarde con la extension .bat

ALU ( arithmetic logic unit ) vhdl codigo

library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity operaciones is port( clk: in std_logic; switch1,switch2,push1,push2: inout std_logic; display: out std_logic_vector (7 downto 0):="00000000"; leds, anodos: out std_logic_vector (3 downto 0):="0000"); end operaciones; architecture Behavioral of operaciones is signal barrido,bleds,modo: std_logic_vector (1 downto 0):="00"; signal break,break2: std_logic :='0'; signal mode,anod: std_logic_vector (3 downto 0):="0000"; signal contador: std_logic_vector (9 downto 0):="0000000000"; signal disp,disp1,disp2,disp3: std_logic_vector (7 downto 0):="00000010"; signal x,y,z,w: std_logic_vector (3 downto 0):="0000"; signal x2,y2,z2,w2: std_logic_vector (3 downto 0):="0000"; signal matr: std_logic_vector (3 downto 0):="0000"; signal dispa,disp1a,disp2a,disp3...

sumador con carry a bcd atmel89s51

ini: mov P1,0aah Inicio: mov P1, #095h mov a, P1 mov b, P1 swap a anl b, #00001111b anl a, #00001111b c0: cjne a, #00, c1 mov r0, a mov a, b jmp fin c1: cjne a, #01, c2 mov r0, a mov a, b jmp fin c2: cjne a, #02, c3 mov r0, a mov a, b jmp fin c3: cjne a, #03, c4 mov r0, a mov a, b jmp fin c4: cjne a, #04, c5 mov r0, a mov a, b jmp fin c5: cjne a, #05, c6 mov r0, a mov a, b jmp fin c6: cjne a, #06, c7 mov r0, a mov a, b jmp fin c7: cjne a, #07, c8 mov r0, a mov a, b jmp fin c8: cjne a, #08, c9 mov r0, a mov a, b jmp fin c9: cjne a, #09, c0 mov r0, a mov a, b jmp fin jmp Inicio fin: mov b, #00 cc0: cjne a, #00, cc1 add a, r0 jmp fin2 cc1: cjne a, #01, cc2 add a, r0 jmp fin2 cc2: cjne a, #02, cc3 add a, r0 jmp fin2 cc3: cjne a, #03, cc4 add a, r0 jmp fin2 cc4: cjne a, #04, cc5 add a, r0 jmp fin2 cc5: cjne a, #05, cc6 add a, r0 jmp fi...