How to convert scilab code into matlab?

57 visualizaciones (últimos 30 días)
sudha
sudha el 21 de Mzo. de 2014
Comentada: Walter Roberson el 7 de Mayo de 2024
I have a code in Scilab. How to convert that code into Matlab?? Can anyone please tel me..
  2 comentarios
PADMA PRIYA
PADMA PRIYA el 7 de Mayo de 2024
clear ;
clc ;
k = 4; //message bits
n = 7; // block length
m = n-k; //Number o f p a r i t y b i t s
I = eye(k,k); // i d e n t i t y mat r ix
disp (I, ' identity matrix Ik ' )
P =[1,1,0;0,1,1;1,1,1;1,0,1]; // c o e f f i c i e n t mat r ix
disp (P, 'coefficient matrix P' )
G = [P I]; // generator matrix
disp (G, ' generator matrix G' )
H = [eye(k -1,k -1) P' ]; // parity check matrix
disp (H, ' parity check matrix H' )
//message bits
m =[0,0,0,0;0,0,0,1;0,0,1,0;0,0,1,1;0,1,0,0;0,1,0,1;0,1,1,0;0,1,1,1;];
C = m*G;
C = modulo (C ,2) ;
disp (C, 'Code words o f ( 7 , 4 ) Hamming code ' )
Walter Roberson
Walter Roberson el 7 de Mayo de 2024
clear ;
clc ;
k = 4; %//message bits
n = 7; %// block length
m = n-k; %//Number o f p a r i t y b i t s
I = eye(k,k); %// i d e n t i t y mat r ix
disp (' identity matrix Ik ' )
identity matrix Ik
disp(I)
1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
P =[1,1,0;0,1,1;1,1,1;1,0,1]; %// c o e f f i c i e n t mat r ix
disp ('coefficient matrix P' )
coefficient matrix P
disp ( P )
1 1 0 0 1 1 1 1 1 1 0 1
G = [P I]; %// generator matrix
disp (' generator matrix G' )
generator matrix G
disp ( G )
1 1 0 1 0 0 0 0 1 1 0 1 0 0 1 1 1 0 0 1 0 1 0 1 0 0 0 1
H = [eye(k -1,k -1) P' ]; %// parity check matrix
disp (' parity check matrix H' )
parity check matrix H
disp ( H )
1 0 0 1 0 1 1 0 1 0 1 1 1 0 0 0 1 0 1 1 1
%//message bits
m =[0,0,0,0;0,0,0,1;0,0,1,0;0,0,1,1;0,1,0,0;0,1,0,1;0,1,1,0;0,1,1,1;];
C = m*G;
C = mod (C ,2) ;
disp ( 'Code words o f ( 7 , 4 ) Hamming code ' )
Code words o f ( 7 , 4 ) Hamming code
disp ( C )
0 0 0 0 0 0 0 1 0 1 0 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 1 0 1 1 0 1 0 0 1 1 0 0 1 0 1 1 0 0 0 1 1 0 0 0 1 0 1 1 1

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 21 de Mzo. de 2014
Paste it into MATLAB and start changing it into MATLAB syntax.

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by