please using matlab for this question. below are question 1 which I don\'t need
ID: 2291296 • Letter: P
Question
please using matlab for this question.
below are question 1 which I don't need the answer just for you to take information needed inside. thanks
first one is what I need using matlab. thanks
2. Write a program to generate three sequences, each of length 1000 as follows. {r(1), 1 = 1, 2, ,L} is an independent sequence of uniformly dis- tributed random variables from an alphabet of size four, ie. the alphabet is distributed 10, 1,2,3). Let [z(i), 1,2,...,L be a binary uniformly sequence of length L. The ith elernent of {y(1), 1-1, 2, . . . , L} is )mod (x(i) + z(1),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 generated. (b) Use the program from the previous problem to calculate p(x), p(y), p() P(yjz). (c) Use the program from the previous problem to calculate H(X), H(Yy), (d) Repeat (a), (b) and (c) when z(i) is a sequence of 1's. Explain your results.Explanation / Answer
ANSWER:
THE BELOW IS THE MATLAB CODE WITH RESPECT TO THE GIVEN DATA;
It 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.