0% found this document useful (0 votes)
28 views1 page

Assignment 4-1

This document outlines 8 assignments involving plotting functions and analyzing data in MATLAB. The assignments include plotting sin, cos and other functions, creating vectors, sorting data, and generating histograms, bar graphs, mesh plots and other visualizations.

Uploaded by

sudeepiitb
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
0% found this document useful (0 votes)
28 views1 page

Assignment 4-1

This document outlines 8 assignments involving plotting functions and analyzing data in MATLAB. The assignments include plotting sin, cos and other functions, creating vectors, sorting data, and generating histograms, bar graphs, mesh plots and other visualizations.

Uploaded by

sudeepiitb
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/ 1

Assignment 4: Matlab

Course Instructor:Dr. Sudeep Kundu


Department of Mathematical Sciences
Rajiv Gandhi Institute of Petroleum Technology Jais Amethi

1. Plot x versus y for y = sin(x). Let x vary from 0 to 2π in increments of 0.1π.


(a) Add a title and labels to your plot.
2. Plot x versus y1 and y2 for y1 = sin(x) and y2 = cos(x). Let x vary from 0 to 2π in increments of 0.1π. Add a title and
labels to your plot
(a) Add a legend to the graph.
(b) Adjust the axes so that the x-axis goes from −1 to 2π + 1 and the y-axis from −1.5 to +1.5.
3. Subdivide a figure window into two rows and one column.
(a) plot y = tan(x) for −1.5 ≤ x ≤ 1.5. Use an increment of 0.1.
(b) Add a title and axis labels to your graph.
(c) plot y = sinh(x) for the same range.
(d) Add a title and labels to your graph.
4. Create a plot of the functions that follow, using fplot.
(a) f (t) = 5t2 .
(b) f (t) = 5(sin(t))2 + t(cos(t))2 .
(c) f (t) = sin(t) + log(t).
π
5. Create a vector x of values from 0 to 20π, with a spacing of 100 . Define vectors y and z as

y = x sin(x)

and
z = x cos(x)
(a) Create an x–y plot of x and y.
(b) Create a polar plot of x and y.
(c) Create a three-dimensional line plot of x, y, and z. Don’t forget a title and labels.
(d) Generate a contour plot of Z.
(e) Generate a combination surface and contour plot of Z.
6. Create x and y vectors from −5 to +5 with a spacing of 0.5. Use the meshgrid function to map x and y onto two new
two-dimensional matrices called X and Y . Use your new matrices to calculate vector Z, with magnitude
p
Z = sin( X 2 + Y 2 )

(a) Use the mesh plotting function to create a three-dimensional plot of Z.


(b) Use the surf plotting function to create a three-dimensional plot of Z. Compare the results you obtain with a single
input Z with those obtained with inputs for all three dimensions (X, Y, Z).
7. Let the vector G = [68, 83, 61, 70, 75, 82, 57, 5, 76, 85, 62, 71, 96, 78, 76, 68, 72, 75, 83, 93] represent the distribution of final
grades in an engineering course.
(a) Use MATLAB to sort the data and create a bar graph of the scores.
(b) Create a histogram of the scores, using hist.
8. Draw the mesh plot of following function:
xex
(a) z = 2y for 1 ≤ x ≤ 5 and 1 ≤ y ≤ 5.
(b) z = log(x2 + y 2 ) for 1 ≤ x ≤ 5 and 1 ≤ y ≤ 5.
yP 2
(c) z = x2 +y 2 for 1 ≤ x ≤ 5 and 1 ≤ y ≤ 5

You might also like