Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

a) Create a scatter plot for the joint pmf p(x,z). You may do this neatly by han

ID: 2248186 • Letter: A

Question

a) Create a scatter plot for the joint pmf p(x,z). You may do this neatly by hand, or you can use the MATLAB function scatter to get a picture like the one shown for the joint x-y pmf. Put "x" on the horizontal axis and "y" on the vertical axis.

b) Develop a matrix for the pmf p(x|z). Let the rows be "z", increasing from top to botton. Let the columns be "x", increasing from left to right.

c) Create a scatter plot for the conditional pmf p(z|x).

d) Create a stem plot for the pmf p(z). You may do this neatly by hand, or you can use the MATLAB function stem. Put "x" on the horizontal axis and "z" on the vertical axis.

e) What is E{z}?

x and v

Explanation / Answer

a)Scatter Plot

Syntax

scatter(x,y)

scatter(x,y,sz)

scatter(x,y,sz,c)

scatter(___,'filled')

scatter(___,mkr)

scatter(___,Name,Value)

scatter(ax,___)

s = scatter(___)

Display the scatter plot of the constellation.

B)

f3 = figure('Color',[1,1,1]); hold on;             % new figure with a white background
p5 = plot(domain,f(domain),'--r','LineWidth',3);   % plot a thick dashed red line
p6 = plot(domain,g(domain),'-b','LineWidth',3);    % plot a thick solid blue line
subdomain = domain(1:400:end);                     % we will plot error bars at every 400th point
% standard deviation of g(domain)
% make correct size, as needed by errorbar
p7 = errorbar(subdomain,g(subdomain),oneSTD);      % plot the error bars
title('example figure','FontSize',12);             % add a title
xlabel('distance','FontSize',12);                  % label the horizontal axis
ylabel('height','FontSize',12);                    % label the vertical axis
axis([-3,3,-5,15]);                                % set the axis range
grid on;                                           % add grid lines
legend('f', 'g');

c)

colors <- rep("black", length(x))

colors[x<3] <- "red"

colors[x>1549] <- "pink"

plot(x, y, xlab="chr X position (Mb)",

           ylab="Diversity",

           pch=16, cex =0.7,

           col = colors)

set.seed(1)

x <- sample(1600)

col <- c("red", "black", "purple")

col <- col[cut(x, breaks=c(-Inf, 3, 1549, Inf))]

d)

plot(-2:5, (-2:5).^2-1)

%# vertical line

hx = graph2d.constantline(0, 'LineStyle',':', 'Color',[.7 .7 .7]);

changedependvar(hx,'x');

%# horizontal line

hy = graph2d.constantline(0, 'Color',[.7 .7 .7]);

changedependvar(hy,'y');