Computer Question 1:
Plot and Subplot
Write Matlab code that displays the following four graphs next to each other (in
one figure) as seen below.
Let x contain 100 evenly spaced points, running from
0 to 10.
Title and label both the x and y axes of your graph.
a) y = x
2
b) y = x
3
c) y = (x-
5)
3
d)
y =
√
x
x = linspace(0,10,100);
subplot(2,2,1); plot(x, x.^2); title(‘x squared’); xlabel(‘x’); ylabel(‘y’);
subplot(2,2,2); plot(x, x.^3); title(‘x cubed’); xlabel(‘x’); ylabel(‘y’);
subplot(2,2,3); plot(x, (x-5).^3); title(‘x - 5 cubed’); xlabel(‘x’); ylabel(‘y’);
subplot(2,2,4); plot(x, sqrt(x)); title(‘sqrt of x’); xlabel(‘x’); ylabel(‘y’);
-4 if they have minor syntax errors (they had the computer to check answers)
-6 if they are missing titles, xlabels, and/or ylabels, or can’t dot
multiply/exponentiate
-8 if they at least successfully use 2 of the following: subplot, plot, and linspace
-10 if they at least successfully use 1 of the following: subplot, plot, and linspace
-12 if they seem to kind of understand how to plot things
-14 otherwise
Computer Question 2:
Paychecks
You must calculate the salary for an employee.
First, prompt the user to enter