problem with creat function

hi
can anyone explain to me what i should do i dont where is the problem ?
thats all i know what to do
a = DecodeSyndromeMethod( H, SyndromeTable, Received' );
CodewordEstimates = a';
function CodewordEstimates = blockDecodeSyndromeMethod( H, SyndromeTable, Received )
%Wrapper function, that allows for using
% the existing row-vector oriented DecodeSyndromeMethod function in
% a column block-oriented simulation.
% a for cycle is allowed here
% use the provided function DecodeSyndromeMethod() for your implementation
%the function prototype and helpt text is here:
% CodewordEstimates = DecodeSyndromeMethod( H, SyndromeTable, Received )
% CodewordEstimate = DecodeSyndromeMethod( SyndromeTable, Received )
% decoding of LBC using syndrome method.
% SyndromeTable structure is generated internally if the H matrix is
% submitted as a first parameter instead - DecodeSyndromeMethod autodetects
% the nature of the first argument.
% The second parameter is the set of received GF(2) words to be decoded.
% The codewords set must be stored row-wise in a single matrix.
% The resulting codewords estimated are stored in the same fashion.

4 Comments

This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.
my problem is how to use H matrix submitted as a first parameter instead of DecodeSyndromeMethod autodetects
i dont know who exactly i will use H matrix in function
here is the main code
r = 3 ;
[ n, k] = HammingCodeNK( r ) ;
blockSize = 50 ;
step = 0.1 ;
pb = 0.002 ; % if error probability is small, ECC improves BER
pb = 0.3 ; % if error probability is large, ECC worsens BER
[ H G ] = HammingCodeHG( r ) ;
dmin = FindCodeSpectrum( G ) ;
tcor = floor( ( dmin - 1 ) / 2 ) ;
SynTable = FindSyndromeTable( H, dmin ) ;
UserData = binarySource( k, blockSize ) ;
CodedData = UserData ;
CodedData = mod(G'*UserData, 2) ; %
TXData = CodedData ;
Errors = binaryErrorMatrix( pb, n, blockSize ) ;
PbTest = size( find( Errors == 1 ) , 1 )/ prod( size( Errors ) ) ;
RXData = mod( CodedData + Errors, 2 ) ;
CodewordsEstimate = RXData ;
CodewordsEstimate = blockDecodeSyndromeMethod( SynTable, RXData ); %
EstimatedData = CodewordsEstimate ;
EstimatedData = CodewordsEstimate(1:4,:) ; %
%EstimatedData = CodewordsEstimate(1:size,:) ; %
You have
CodewordsEstimate = blockDecodeSyndromeMethod( SynTable, RXData ); %
Why not pass
CodewordsEstimate = blockDecodeSyndromeMethod(H, SynTable, RXData ); %
??
I don't think I understand what the question is.
i dont know where is the problem i creat the function
function CodewordEstimates = blockDecodeSyndromeMethod( H, SyndromeTable, Received )
a = DecodeSyndromeMethod( H, SyndromeTable, Received );
CodewordEstimates = a;
but after run the main code i still have same error
r = 3 ;
[ n, k] = HammingCodeNK( r ) ;
blockSize = 1000 ;
step = 0.1 ;
%pb = 0.002 ;
pb = 0.3 ;
[ H G ] = HammingCodeHG( r ) ;
dmin = FindCodeSpectrum( G ) ;
tcor = floor( ( dmin - 1 ) / 2 ) ;
SynTable = FindSyndromeTable( H, dmin ) ;
UserData = binarySource( k, blockSize ) ;
CodedData = mod(G'*UserData, 2) ; %
TXData = CodedData ;
Errors = binaryErrorMatrix( pb, n, blockSize ) ;
%test error generator quality
PbTest = size( find( Errors == 1 ) , 1 )/ prod( size( Errors ) ) ;
RXData = mod( CodedData + Errors, 2 ) ;
CodewordsEstimate = blockDecodeSyndromeMethod( H,SynTable, RXData ); %
EstimatedData = CodewordsEstimate(1:k,:) ;
Error using DecodeSyndromeMethod
Too many input arguments.
Error in blockDecodeSyndromeMethod (line 21)
pomocna = DecodeSyndromeMethod( H, SyndromeTable, Received );
Error in simBSCECC (line 42)
CodewordsEstimate = blockDecodeSyndromeMethod( H,SynTable, RXData ); %

Sign in to comment.

Answers (1)

Your blockDecodeSyndromeMethod is trying to call DecodeSyndromeMethod with more inputs than DecodeSyndromeMethod wants.
However, we as outside people have no idea what the code for DecodeSyndromeMethod is. It appears to be something you were provided with as part of an assignment.
According to the comments in the blockDecodeSyndromeMethod,
% CodewordEstimates = DecodeSyndromeMethod( H, SyndromeTable, Received )
% CodewordEstimate = DecodeSyndromeMethod( SyndromeTable, Received )
which implies that you should be able to pass three parameters.
But right after that the comments say
% SyndromeTable structure is generated internally if the H matrix is
% submitted as a first parameter instead - DecodeSyndromeMethod autodetects
% the nature of the first argument.
If the SyndromeTable is generated internally if H is provided as the first parameter, then it seems strange that there would be a syntax that permitted passing both H and SyndromeTable . It would seem more likely that the two supported syntaxes were
% CodewordEstimates = DecodeSyndromeMethod( H, Received )
% CodewordEstimate = DecodeSyndromeMethod( SyndromeTable, Received )
You were told that three parameters can be passed but the code provided by the instructors is rejecting three parameters. That is not your fault: you should inform the instructors that their code does not function properly.
But in the meantime, the workaround is probably to call DecodeSyndromeMethod( H, Received )

Categories

Find more on Elementary Math in Help Center and File Exchange

Products

Tags

Asked:

on 17 Oct 2021

Answered:

on 18 Oct 2021

Community Treasure Hunt

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

Start Hunting!