How to fix this error undefined function 'poly2sym ' for input arguments of type 'uint8'
古いコメントを表示
clear all;
close all;
clc;
disp('systematic encoder');
n=input('enter the value of n=');
k=input('enter the value of k=');
x=sym('x'); %create symbolicvariable of x
g=input('enter the coeff of generator polynomial');
gp=poly2sym(g); %converts numeric coeff to symbolic const
disp('generator polynomial g(x)=');
disp(gp);
b=2^k;
for i=0:b-1
disp(['sr no:',num2str(i+1)]);
disp('input data word');
d=bitget(uint8(i),4:-1:1);
mp=poly2sym(d);
disp('');
disp('message polynomial m(x)=');
disp(mp);
disp('');
y=x^(n-k)*mp;
disp('x^(n-k)*mp=');
disp(y);
z=sym2poly(y);
[q,r]=deconv(z,g);
ss=z+r;
cp=mod(ss,2);
disp('codeword is=');
disp(cp);
cx=poly2sym(cp);
disp('codeword polynomial c(x)=');
disp(cx);
disp('weight of polynomial');
wt=sum(nonzeros(cp));
end
dmin=n-k;
disp(['minimum hamming distance',num2str(dmin)]);
disp(['error detection capacity=',num2str(dmin-1)]);
disp(['error correction capability=',num2str((dmin-1)/2)]);
回答 (1 件)
Walter Roberson
2020 年 3 月 21 日
mp = poly2sym( double(d) );
7 件のコメント
Shweta SONAWANE
2020 年 3 月 21 日
編集済み: Shweta SONAWANE
2020 年 3 月 21 日
Walter Roberson
2020 年 3 月 21 日
What inputs should we use to test, and what outputs would be expected?
Shweta SONAWANE
2020 年 3 月 21 日
Shweta SONAWANE
2020 年 3 月 21 日
Walter Roberson
2020 年 3 月 21 日
The output I get for n=7 k=4 coefficients [1 1 0 1] is
error correction capability=1
I tested in your version, R2018b, in case there was something different in newer releases.
Shweta SONAWANE
2020 年 3 月 21 日
Walter Roberson
2020 年 3 月 21 日
After you run the code, please execute these and tell us the results:
class(dmin)
dmin
dmin-1
(dmin-1)/2
num2str((dmin-1)/2)
mod(dmin,1)
カテゴリ
ヘルプ センター および File Exchange で Vector Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!