How to convert scilab code into matlab?

57 ビュー (過去 30 日間)
sudha
sudha 2014 年 3 月 21 日
コメント済み: Walter Roberson 2024 年 5 月 7 日
I have a code in Scilab. How to convert that code into Matlab?? Can anyone please tel me..
  2 件のコメント
PADMA PRIYA
PADMA PRIYA 2024 年 5 月 7 日
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 2024 年 5 月 7 日
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

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2014 年 3 月 21 日
Paste it into MATLAB and start changing it into MATLAB syntax.

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by