complete the def statment in python please Part E (4 points) Write a function wh
ID: 3601170 • Letter: C
Question
complete the def statment in python please
Part E (4 points) Write a function which takes in a vector X and plots a histogram for X, the centered version of X, the standardized version of X and the normalized version of X. Be sure to use one figure and 4 axes. Also create a title for each subplot and one title for the whole plot. You may find the function plt.tight_layout to be useful here. 1 def plot_transforms (x): Plot histogram of x and transformations" YOUR CODE HERE 5 raise NotImplementedError) 7 np.random.seed (1234) 8 x = np.randon.gumbel (4, 5, 1000) 9 plot transforms (x); Part F (3 points) Write a function which takes in a 2 dimensional matrix X, makes a scatter plot of the rows, and makes a scatter plot of the rows projected onto the unit circle Be sure to only create one figure and 2 subplots. Include a title for each subplot and a title for the whole plot. Again, the function plt.tight_layout( may be useful here 1 def plot_project(x): Plot a scatter plot of X and of the rows projected on to the circle" # YOUR CODE HERE 5 raise NotImplementedError) 7np.random. seed (1234) 8 x1 = np.randon.exponentia1(4, 1000) 9 x2 np.randon.chsquare (2, 1000) x2]).T x = np.vstack ((x1, 11 plot_project (X) 10Explanation / Answer
histogram(X)
histogram(X,nbins)
histogram(X,edges)
histogram('BinEdges',edges,'BinCounts',counts)
histogram(C)
histogram(C,Categories)
histogram('Categories',Categories,'BinCounts',counts)
histogram(___,Name,Value)
histogram(ax,___)
h = histogram(___)
x = randn(1000,1);
nbins = 50;
hist(x,nbins)
x = randn(1000,1);
subplot(3,1,1)
xbins1 = -4:4;
hist(x,xbins1)
subplot(3,1,2)
xbins2 = -2:2;
hist(x,xbins2)
subplot(3,1,3)
xbins3 = [-4 -2.5 0 0.5 1 3];
hist(x,xbins3)
x = randn(1000,1);
ax1 = subplot(2,1,1);
hist(ax1,x,50)
ax2 = subplot(2,1,2);
xbins = [-3 0 3];
hist(ax2,x,xbins)
x = randn(1000,1);
[counts,centers] = hist(x)
h = findobj(gca,'Type','patch');
h.FaceColor = [0 0.5 0.5];
h.EdgeColor = 'w';
x = [0 2 9 2 5 8 7 3 1 9 4 3 5 8 10 0 1 2 9 5 10];
hist(x)
x = randn(1000,1);
nbins = 50;
hist(x,nbins)
x = randn(1000,1);
subplot(3,1,1)
xbins1 = -4:4;
hist(x,xbins1)
subplot(3,1,2)
xbins2 = -2:2;
hist(x,xbins2)
subplot(3,1,3)
xbins3 = [-4 -2.5 0 0.5 1 3];
hist(x,xbins3)
x = randn(1000,1);
ax1 = subplot(2,1,1);
hist(ax1,x,50)
ax2 = subplot(2,1,2);
xbins = [-3 0 3];
hist(ax2,x,xbins)
x = randn(1000,1);
[counts,centers] = hist(x)
h.FaceColor = [0 0.5 0.5];
h.EdgeColor = 'w';
rose(theta)
rose(theta,x)
rose(theta,nbins)
rose(ax,...)
h = rose(...)
[tout,rout] = rose(...)
theta = [0.4 1.4 3.1 2.3 0.4 2.5 3.9 2.8 2.3 1.6 4.6 4.5 6.1 3.9 5.1];
rose(theta,10)
SelfAssessedHealthStatus = categorical(SelfAssessedHealthStatus,...
{'Poor' 'Fair' 'Good' 'Excellent'},'Ordinal',true);
figure
histogram(SelfAssessedHealthStatus)
title('Self Assessed Health Status From 100 Patients')
figure
histogram(Location(SelfAssessedHealthStatus<='Fair'))
title('Location of Patients in Fair or Poor Health')
figure
A = countcats(SelfAssessedHealthStatus);
C = categories(SelfAssessedHealthStatus);
pareto(A,C);
title('Self Assessed Health Status From 100 Patients')
X1 = Weight(Gender=='Female');
Y1 = Height(Gender=='Female');
X2 = Weight(Gender=='Male');
Y2 = Height(Gender=='Male');
figure
h1 = scatter(X1,Y1,'o');
hold on
h2 = scatter(X2,Y2,'x');
title('Height vs. Weight')
xlabel('Weight (lbs)')
ylabel('Height (in)')
[N,edges] = histcounts(X)
[N,edges] = histcounts(X,nbins)
[N,edges] = histcounts(X,edges)
[N,edges,bin] = histcounts(___)
N = histcounts(C)
N = histcounts(C,Categories)
[N,Categories] = histcounts(___)
[___] = histcounts(___,Name,Value)
X = [2 3 5 7 11 13 17 19 23 29];
[N,edges] = histcounts(X,6)
X = randn(1000,1);
edges = [-5 -4 -2 -1 -0.5 0 0.5 1 2 4 5];
N = histcounts(X,edges)
n = hist3(dat); % default is to 10x10 bins
n1 = n';
n1(size(n,1) + 1, size(n,2) + 1) = 0;
xb = linspace(min(dat(:,1)),max(dat(:,1)),size(n,1)+1);
yb = linspace(min(dat(:,2)),max(dat(:,2)),size(n,1)+1);
h = pcolor(xb,yb,n1);
h.ZData = ones(size(n1)) * -max(max(n));
colormap(hot) % heat map
title('Seamount:Data Point Density Histogram and Intensity Map');
grid on
view(3);
X = [MPG,Weight];
hist3(X,[7 7]);
xlabel('MPG'); ylabel('Weight');
hist3(X,[7 7],'FaceAlpha',.65);
xlabel('MPG'); ylabel('Weight');
set(gcf,'renderer','opengl');
X = [MPG,Weight];
hist3(X,[7 7]);
xlabel('MPG'); ylabel('Weight');
set(gcf,'renderer','opengl');
set(get(gca,'child'),'FaceColor','interp','CDataMode','auto');
A = [5 7 8; 0 1 9; 4 3 6];
A(:,:,2) = [1 0 4; 3 5 6; 9 8 7]
A(:,:,1) =
5 7 8
0 1 9
4 3 6
A(:,:,2) =
1 0 4
3 5 6
9 8 7
A(:,:,3) = 5
A(:,:,1) =
5 7 8
0 1 9
4 3 6
A(:,:,2) =
1 0 4
3 5 6
9 8 7
A(:,:,3) =
5 5 5
5 5 5
5 5 5
A{1,1} = [1 2;4 5];
A{1,2} = 'Name';
A{2,1} = 2-4i;
A{2,2} = 7;
B{1,1} = 'Name2';
B{1,2} = 3;
B{2,1} = 0:1:3;
B{2,2} = [4 5]';
C = cat(3, A, B);
patient(1,1,1).name = 'John Doe';
patient(1,1,1).billing = 127.00;
patient(1,1,1).test = [79 75 73; 180 178 177.5; 220 210 205];
patient(1,2,1).name = 'Ann Lane';
patient(1,2,1).billing = 28.50;
patient(1,2,1).test = [68 70 68; 118 118 119; 172 170 169];
patient(1,1,2).name = 'Al Smith';
patient(1,1,2).billing = 504.70;
patient(1,1,2).test = [80 80 80; 153 153 154; 181 190 182];
patient(1,2,2).name = 'Dora Jones';
patient(1,2,2).billing = 1173.90;
patient(1,2,2).test = [73 73 75; 103 103 102; 201 198 200];
patient(1,1,2):
sum((patient(1,1,2).test));
Similarly, add all the billing fields in the patient array:
total = sum([patient.billing]);
A = cat(3,[9 2; 6 5], [7 1; 8 4]);
B = cat(3,[3 5; 0 1], [5 6; 2 1]);
C = cat(4,A,B,cat(3,[1 2; 3 4], [4 3; 2 1]));
A = cat( 3, [1 2 3; 9 8 7; 4 6 5], [0 3 2; 8 8 4; 5 3 5], ...
[6 4 7; 6 8 5; 5 4 3]);
% The EIG function is applied to each of the horizontal 'slices' of A.
for i = 1:3
eig(squeeze(A(i,:,:)))
end
x1 = -2*pi:pi/10:0;
x2 = 2*pi:pi/10:4*pi;
x3 = 0:pi/10:2*pi;
[x1,x2,x3] = ndgrid(x1,x2,x3);
z = x1 + exp(cos(2*x2.^2)) + sin(x3.^3);
slice(z,[5 10 15], 10, [5 12]);
axis tight
x = 1:3;
y = 1:5;
[X,Y] = meshgrid(x,y)
X.^2 + Y.^2
x = -2:0.25:2;
y = x;
[X,Y] = meshgrid(x);
F = X.*exp(-X.^2-Y.^2);
surf(X,Y,F)
surf(x,y,x.*exp(-x.^2-(y').^2))
x = 0:2:6;
y = 0:1:6;
z = 0:3:6;
[X,Y,Z] = meshgrid(x,y,z);
F = X.^2 + Y.^2 + Z.^2;
gridsize = size(F)
[X,Y,Z] = meshgrid(x);
G = X.^2 + Y.^2 + Z.^2;
gridsize = size(G)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.