problem with creat function

1 view (last 30 days)
amjad hammad
amjad hammad on 17 Oct 2021
Answered: Walter Roberson on 18 Oct 2021
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
Walter Roberson
Walter Roberson on 17 Oct 2021
You have
CodewordsEstimate = blockDecodeSyndromeMethod( SynTable, RXData ); %
Why not pass
CodewordsEstimate = blockDecodeSyndromeMethod(H, SynTable, RXData ); %
??
I don't think I understand what the question is.
amjad hammad
amjad hammad on 18 Oct 2021
Edited: amjad hammad on 18 Oct 2021
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)

Walter Roberson
Walter Roberson on 18 Oct 2021
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 )

Tags

Products

Community Treasure Hunt

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

Start Hunting!