Effacer les filtres
Effacer les filtres

Convintrlv: What is the best way to implement convintrlv for one packet?

17 vues (au cours des 30 derniers jours)
Dylan Ditta
Dylan Ditta le 27 Août 2024 à 14:37
Réponse apportée : Shivam Gothi le 27 Août 2024 à 16:15
openExample('comm/DigitalVideoBroadcastingTerrestrialExample','supportingFile','commdvbt.slx')
I have been using this example as a reference to build a DVBT simulation on Matlab with code rather than a simulink block diagram. One problem I have encountered is that I seem to have to zero pad the convolutional interleaver by a lot to be able to have enough data for the deinterelaver to recreate the original message.
simple example to show what I mean:
nrows = 3
slope = 1
x = [1 2 3 4 5 6 7 8 9 10];
x_prime = convintrlv(x,nrows,slope) = [1 0 0 4 2 0 7 5 3 10]
x = convdeintrlv(x_prime,nrows,slope) = [0 0 0 0 0 0 1 2 3 4]
Obviously it is decoding the message but theres a delay and Id have to introduce a delay to get the whole picture. So then I pad with zeros.
x = [x 0 0 0 0 0 0];
x_prime = convintrlv(x,nrows,slope) = [1 0 0 4 2 0 7 5 3 10 8 6 0 0 9 0]
x = convdeintrlv(x_prime,nrows,slope) = [0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 10]
Cool, but now my message has turned from a length 10 packet to a length 16 packet and this will affect later subsystems. What is a good way to solve for this?
I know in the DVBT example I showed at the top there is a buffer command. I'm not sure how to implement it, though.

Réponses (1)

Shivam Gothi
Shivam Gothi le 27 Août 2024 à 16:15
Hello,
I see that you are working on implementing convintrlv and convdeintrlv using MATLAB code. However, it seems that the delay introduced in output signal and the zero-padding stages are not ideal for your requirements.
While implementing convintrlv and convdeintrlv, the delay is inhereritant and we cannot do any thing to remove.
But there is a work-around for this.
To implement it as a MATLAB code, you can automate the process of padding extra zeros to input signal and removing the excess zeros from the output signal by defining a "user defined function".
I have made two user defined functions in files "UserDefined_convintrlv.m" and "UserDefined_convdeintrlv.m". They are attached with the answer.
You can use them as shown below:
x = [1 2 3 4 5 6 7 8 9];
x_prime=UserDefined_convintrlv(x,3,1);
the output of above code is:
Now, again se the user defined function "UserDefined_convdeintrlv" as shown in below code:
x=UserDefined_convdeintrlv(x_prime,3,1)
The output of above command is attached below:
In this way you can get rid of manuall adding the zeros. Also, the output generated by "convdeintrlv" is free from any delay.
I have tested both the user defined functions for different values of "nRows" and "slope". I found that it is working.
I am also attaching the code of "UserDefined_convintrlv.m" and "UserDefined_convdeintrlv.m", in case the attached files failed to open.
%User defined function for convintrlv. Save the file with name "UserDefined_convintrlv.m"
function out = UserDefined_convintrlv(x,nRows,slope)
zeros_to_be_padded=zeros(1,nRows*(nRows-1)*slope);
x=[x zeros_to_be_padded];
out = convintrlv(x,nRows,slope);
end
%User defined function for convdeintrlv. Save the file with name "UserDefined_convdeintrlv.m"
function out = UserDefined_convdeintrlv(x,nRows,slope)
zeros_to_be_removed=nRows*(nRows-1)*slope;
temp_out = convdeintrlv(x,nRows,slope);
out = temp_out(zeros_to_be_removed+1:end);
end
"REMEMBER TO PLACE THE "UserDefined_convintrlv.m" and "UserDefined_convdeintrlv.m" FILES IN THE SAME WORKING DIRECTORY.
I hope this helps...

Catégories

En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by