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!