Azzera filtri
Azzera filtri

How to convert scilab code into matlab?

50 visualizzazioni (ultimi 30 giorni)
sudha
sudha il 21 Mar 2014
I have a code in Scilab. How to convert that code into Matlab?? Can anyone please tel me..
  2 Commenti
PADMA PRIYA
PADMA PRIYA il 7 Mag 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 il 7 Mag 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

Accedi per commentare.

Risposte (1)

Image Analyst
Image Analyst il 21 Mar 2014
Paste it into MATLAB and start changing it into MATLAB syntax.

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by