Start learning today, and be successful in your academic & professional career. Start Today!

• ## Related Books

### Start Learning Now

Our free lessons will get you started (Adobe Flash® required).

### Membership Overview

• *Ask questions and get answers from the community and our teachers!
• Practice questions with step-by-step solutions.
• Track your course viewing progress.
• Learn at your own pace... anytime, anywhere!

### Graphics, Part 3

• MATLAB has a variety of functions for displaying and visualizing data in 3-D., either as lines in 3-D, or as various types of surfaces.
• In this session we are going to introduce plot3, mesh and surf for different 3-D plots, at the end of this session we are going to see some other special graphics capability of MATLAB as well.

### Graphics, Part 3

Draw graphs of x2, x3, x4, ex2  over interval of 0 < x < 4, using plot function and semilog function.
x = 0:0.001:4;
semilogy(x,x. 2)
semilogy(x,x. 3)
semilogy(x,x. 4)
semilogy(x,exp(x. 2))
The initial heat over a steel plate is given by the function:
u(x,y)=80y2e−x2−0.3y2
Plot the surface over the grid defined by: −2.1 < x < 2.1, −6 < y < 6, where the grid width is 0.15 in both directions.
x = -2.1:0.15:2.1;
y = -6:0.15:6;
for i = 1:numel(x)
for k = 1:numel(y)
U(i,k) = 80*(y(k). 2).*(exp(-x(i). 2-0.3*y(k). 2));
end
end

mesh(U)
Draw a graph of the population of the USA from 1790 to 2000, using the following model:
P(t)=[197273000/(1+e−0.03134(t−1913.25))] Where t is the date in years.
Actual data (in 1000s) for every decade from 1790 to 1950 are as follows:
3929, 5308, 7240, 9638, 12866, 17069, 23192, 31443, 38558, 50156, 62948, 75995, 91972, 105711, 122775, 131669, 150697.
Superimpose this data on the graph P(t) (plot this data in circles and red, and do not join them with lines).
t = 1790:10:2000;

for i = 1:numel(t)
P(i) = 197273000/(1+exp(-0.03134*(t(i)-1913.25)));
end

t2 = 1790:10:1950;
reP = [3929 5308 7240 9638 12866 17069 23192 31443 38558 50156 62948 75995 91972 105711 122775 131669
150697]*1000;

plot(t,P)
hold on
plot(t2,reP,'rO')
The spiral of Archimedes may be represented in polar coordinates by the equation:
r=aθ
Where a is some constant, write some command-line statements to draw the spiral for some value of r.
a = 2;
q = 1.25;
th = 0:pi/40:5*pi;
subplot(2,1,1)
plot(a*th.*cos(th), a*th.*sin(th)), ...
title('(a) Archimedes') % or use polar
subplot(2,1,2)
plot(a/2*q. th.*cos(th), a/2*q. th.*sin(th)), ...
title('(b) Logarithmic') % or use polar
A rather beautiful fractal picture can be drawn by plotting the points (xk, yk) generated by the following difference equations:
xk+1=yk(1+sin 0.7xk)−1.2√{|xk|}
yk+1=0.21−xk
Starting with x0=y0=0. Write a program to draw the picture (plot individual points; do not join them).
x(1) = 0;
y(1) = 0;

for i = 2:1000
x(i) = y(i-1)*(1+sin(0.7*x(i-1))) - 1.2*sqrt(abs(x(i-1)));
y(i) = 0.21 - x(i-1);
end

plot(x,y,'.')

*These practice questions are only helpful when you work on them offline on a piece of paper and then use the solution steps function to check your answer.

### Graphics, Part 3

Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

• Intro 0:00
• Comet3 2:37
• Mesh Surfaces 3:02
• Visualizing Vector Fields 5:29
• Contour