Question

Q)

a) create a matrix named as X of evenly spaced values from 0 to
50, with an increment of 10.

b) a) create a matrix named as Y of evenly spaced values from 500
to 1000, with an increment of 3.

c)a) create a matrix named as Z, the value of the 1st row is from 1
to 10, 2nd row from 2 to 20 with increment of 2, 3rd row 3 to
12.

using subplot divide the window into three rows and two columns so that the plot from d to h will appear in the same window:

d) generate a vertical bar graph of vector X. title it A bar
graph of vector X

e) generate a pie chart of vector X. title it A pie chart of vector
X

f)generate a three dimensional bar chart of vector Y. title it A 3d
bar graph of vector y

g) create a meshed surface plot of X, Y, Z

h) create a surface plot of X, Y, Z

i)what is the difference between the function used in g,h ( write
the answer in the script file)

j)save the figure as. jpg format

Answer #1

MATLAB CODE

%% part A

x=linspace(0,50,floor((50-0+1)/10)); %% floor takes the greatest
integer to fill argument of total number of samples

%% part b

y=linspace(500,1000,floor((1000-500+1)/3));

%% part c

z=[1 2 3 4 5 6 7 8 9 10; 2 4 6 8 10 12 14 16 18 20; 3 4 5 6 7 8 9
10 11 12];

subplot(3,2,1)

%% part d

bar(x); %% creates vertical bar graph

title('A bar graph of vector X')

In MATLAB, generate a 3D plot as follows:
Create 2 vectors x and y, both ranging from -5 to 5 with
interval of 0.05 using linspace or colon operator.
Generate grid of values X and Y using the
vectors x and y.
Define the variable Z as follows:
Z = 2X3
+ 4Y2 + 7
+sinX3 + Y2
Generate a surface and a mesh plot with the
variables X,Y,Z. Show your plots.

Use Matlab to solve the following
(a) Create a plot with a sphere at the center of the graph
(origin) representing the sun with a radius of 6955000 km. Make
sure that the outside of the sphere is painted in ’autumn’ colors.
(Hint: look up the sphere() function, the colormap() function, and
the surf() function).
(b) Create a variable t ranging from 0 to 2? with increments of
0.01.
(c) The following Table gives you important values needed to
compute...

PLEASE USE MAT LAB ONLY. THANK YOU
(a) Create and plot the signals listed below and save your
Matlab code in a script file.
i) Cosine signal of frequency 100 Hz over the range [0,0.1]
seconds and samples spaced 10^- 4 seconds apart with a phase of
pi/2 and an amplitude of 1.
PLEASE USE MAT LAB ONLY. THANK YOU
ii) A square wave that oscillates between 0 and 1 every five
samples, plot 3 periods of the waveform.
iii)...

Please use Mat lab only. Thanks
(b) Plotting Sunspots
Load the Matlab data file, sunspot.dat, and experiment with
making plots and subplots. The file is a simple 288 row by 2 column
matrix where the first column has consecutive years from 1700 until
1987 and the second column has the mean sunspot number for that
year. Then we will construct year and spots vectors from the two
columns and plot spots as a function of year.
load sunspot.dat;
year =...

Creating and interpreting a Normal Quantile-Quantile (Normal
Q-Q) plot.
The data you will be using is the distance in miles from home to
campus for statistics students.
150
30
105
88
94
15
55
122
45
67
18
126 30
143
98
15
30
62
111
87
38
20
34
39
46 14
144
23
94
44
97
65
120 123
99
45
57
209 20
133 72
Column 1: Sort the data values from least to greatest. Use the...

Curve-Fit Function USING MATLAB
Using the top-down design approach, develop a MATLAB function
A8P2RAlastname.m that reads data from a file and performs
regression analysis using polyfit and polyval. The function shall
have the following features:
The input arguments shall include the file name (string), a
vector of integers for the degrees of polynomial fits to be
determined, and an optional plot type specifier (‘m’ for multiple
plots, ‘s’ for a single plot - default).
The data files will be text...

Assume that we are working with an aluminum alloy (k = 180
W/moC) triangular fin with a length, L = 5 cm, base thickness, b =
1 cm, a very large width, w = 1 m. The base of the fin is
maintained at a temperature of T0 = 200oC (at the left boundary
node). The fin is losing heat to the surrounding air/medium at T? =
25oC with a heat transfer coefficient of h = 15 W/m2oC. Using the...

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 14 minutes ago

asked 22 minutes ago

asked 23 minutes ago

asked 31 minutes ago

asked 32 minutes ago

asked 43 minutes ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago