How to fix this error undefined function 'poly2sym ' for input arguments of type 'uint8'
Mostrar comentarios más antiguos
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)]);
Respuestas (1)
Walter Roberson
el 21 de Mzo. de 2020
mp = poly2sym( double(d) );
7 comentarios
Shweta SONAWANE
el 21 de Mzo. de 2020
Editada: Shweta SONAWANE
el 21 de Mzo. de 2020
Walter Roberson
el 21 de Mzo. de 2020
What inputs should we use to test, and what outputs would be expected?
Shweta SONAWANE
el 21 de Mzo. de 2020
Shweta SONAWANE
el 21 de Mzo. de 2020
Walter Roberson
el 21 de Mzo. de 2020
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
el 21 de Mzo. de 2020
Walter Roberson
el 21 de Mzo. de 2020
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)
Categorías
Más información sobre Vector Data en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!