100% found this document useful (1 vote)
115 views2 pages

Practice Exercises: Graphing Functions Using MATLAB

This document provides 6 practice problems for graphing functions using MATLAB. The problems cover topics like plotting sine waves with different frequencies, polynomials, exponential functions, tangent functions, and using commands like subplot to plot multiple functions in separate windows. Instructions are provided for each problem to graph the given functions and manipulate aspects of the plots using MATLAB commands and plot tools.

Uploaded by

Drake Ramoray
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
115 views2 pages

Practice Exercises: Graphing Functions Using MATLAB

This document provides 6 practice problems for graphing functions using MATLAB. The problems cover topics like plotting sine waves with different frequencies, polynomials, exponential functions, tangent functions, and using commands like subplot to plot multiple functions in separate windows. Instructions are provided for each problem to graph the given functions and manipulate aspects of the plots using MATLAB commands and plot tools.

Uploaded by

Drake Ramoray
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Practice Exercises: Graphing Functions Using MATLAB

Problem 1: The equation for a 10 Hz sine wave with an amplitude of 3 is 3sin(2π(10)t). A


frequency of 10 Hz means the sine wave completes 10 cycles in 1 second. Answer each of the
following questions:

How much time does one cycle (period) of a 10 Hz sine wave take? ____________________

How much time does six cycles of a 10 Hz sine wave take? __________________________

What does this command do in MATLAB? >> t = 0:0.001:0.6

What does this command do in MATLAB? >> y = 3*sin(2*pi*10*t)

What does this command do in MATLAB? >> plot(t,y)

Execute the following statements and explain why the plot doesn’t look like a sine wave:

>> t = 0:0.02:0.6
>> y = 3*sin(2*pi*10*t)
>> plot(t,y)

Execute the following statements and explain why the plot doesn’t look like a sine wave:

>> t = 0:0.001:100;
>> y = 3*sin(2*pi*10*t);
>> plot(t,y);

Problem 2: Plot the polynomial 𝑓(𝑡) = 𝑡 4 − 3.5𝑡 3 − 2.5𝑡 2 + 14𝑡 − 6 from t = 2.5 to 4.

 Click on the plot tools icon as shown in the figure below.


 Use plot tools to add a label on the x-axis, a label on the y-axis, a title, and a grid. Also
change the color of the graph to something other than blue.
 Use the data cursor to estimate all of the roots of the polynomial

Estimated Roots: __________________________________________________


Plot Tools Icon

Problem 3: Plot the function f(t) = e5t for t = 0 to 2. Be sure to use exp(5*t), do not use
exp^(5*t) or e^(5*t). Use MATLAB commands (not plot tools) to add labels to the x-axis
and y-axis, a title, and a grid.

Problem 4: Plot the functions f1(t) = e8t , f2(t) = e10t, and f3(t) = e2t on the same graph. Make
sure to pick a good range for t to effectively display these graphs. This may require a bit of
experimentation on your part. Add a title and label the x-axis. Also, add a legend.

Problem 5: Plot tan(x) from 3π/2 to 3π/2. Since tan(x) is undefined (approaches ∞) at odd
multiples of π/2, your graph will look seriously distorted because the values are so huge as the
angle approaches the asymptotes that the smaller values get swamped out. Minimize your figure
window – don’t close it. Now, use the axis command: >> axis([-3*pi/2 3*pi/2 -10 10]) to make
a better plot of tan(x) from3π/2 to 3π/2 . The axis commands specifies a range for the x-axis
(3π/2 to 3π/2) and a range for the y-axis (-10 to 10). Using the axis command after the plot
statement will re-set the axis. Note: The axis can also be re-set using plot tools.

Problem 6: The subplot command splits the figure window into several sub-windows. The first
two entries in subplot show how the window is to be split up by specifying number of rows and
number of columns. The third entry points to a particular sub-window. So, subplot(3,2,4) would
divide the plot window into 3 rows and 2 columns allowing for 6 smaller plot windows and
would point to the 4th sub-window (2nd row – 2nd column).

Use the subplot command to plot each of the following functions in a separate sub-window:
 4 cycles (periods) of a 5 Hz sine wave with an amplitude of 3 (i.e., 3sin(2π(5)t)). Use the
3rd argument (not plot tools) in plot to make the sine wave a black solid curve.
 3 cycles of a 1000 Hz cosine wave with an amplitude of 5. Use the 3rd argument (not plot
tools) in plot to draw a magenta solid curve with diamond data points.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy