using matlab 2. Write a program to generate three sequences, each of length L-10
ID: 3734976 • Letter: U
Question
using matlab
2. Write a program to generate three sequences, each of length L-1000 as follows. ((), 1,2,.... L is an independent sequence of uniformly dis- tributed random variables from an alphabet of size four, i.e. the alphabet is X = {0, 1, 2, 3). Let {z(i), i = 1, 2, , L} be a binary uniformly distributed sequence of length L. The ith element of (v0),1-1,2,...,L) is v(i)mod (x(6)+(0), 4) (Recall that mod (a, 4) is the remainder obtained after dividing a by 4) (a) Write a program to estimate p(r, y) based on the sequences that you have (b) Use the program from the previous problem to calculate p(x), p(u). p(rly), (e) Use the program from the previous problem to calculate H(X), H(Y), (d) Repeat (a), (b) and (e) when :(0) is a sequence of 1's. Explain your generated p(viz). H(X, Y), I(X:Y), H(XY), H(YX). results.Explanation / Answer
Here is the matlab code for original question. Provide definition of p(x),p(y),H(x),H(y)
clear all;clc;
L=1000;
for i=1:L
x(i)=randi(4,1,1)-1;%randi(4,1,1) will generate a random number between 1 to 4
end
for i=1:L
z(i)=randi(2,1,1)-1;%randi(2,1,1) will generate a random number between 1 to 2
end
for i=1:L
y(i)=mod(x(i)+z(i),4);
end
fprintf('x= ');
disp(x);
fprintf('z= ');
disp(z);
fprintf('y= ');
disp(y);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.