Skip to content Skip to navigation

Connexions

You are here: Home » Content » Graphing with MATLAB | Problem Set

Navigation

Recently Viewed

This feature requires Javascript to be enabled.
 

Graphing with MATLAB | Problem Set

Module by: Serhat Beyenir. E-mail the author

Summary: Problem Set for Graphing with MATLAB

Exercise 1

Plot y=a+bx y a b x , using the specified coefficients and ranges (use increments of 0.1):

  1. a=2 a 2 , b=0.3 b 0.3 for 0x5 0 x 5
  2. a=3 a 3 , b=0 b 0 for 0x10 0 x 10
  3. a=4 a 4 , b=-0.3 b -0.3 for 0x15 0 x 15

Solution

  1. a=2; b=.3; x=[0:.1:5]; y=a+b*x; 
    plot(x,y),title('Graph of y=a+bx'),xlabel('x'),ylabel('y'),grid
    
  2. a=3; b=.0; x=[0:.1:10]; y=a+b*x; 
    plot(x,y),title('Graph of y=a+bx'),xlabel('x'),ylabel('y'),grid
    
  3. a=2; b=.3; x=[0:.1:5]; y=a+b*x; 
    plot(x,y),title('Graph of y=a+bx'),xlabel('x'),ylabel('y'),grid
    

Exercise 2

Plot the following functions, using increments of 0.01 and a=6 a 6 , b=0.8 b 0.8 , 0x5 0 x 5 :

  1. y=a+xb y a x b
  2. y=axb y a x b
  3. y=asinx y a x

Solution

  1. a=6; b=.8; x=[0:.01:5]; y=a+x.^b; 
    plot(x,y),title('Graph of y=a+x^b'),xlabel('x'),ylabel('y'),grid
    
    2a
  2. a=6; b=.8; x=[0:.01:5]; y=a*x.^b; 
    plot(x,y),title('Graph of y=ax^b'),xlabel('x'),ylabel('y'),grid
    
    2a
  3. a=6; x=[0:.01:5]; y=a*sin(x); 
    plot(x,y),title('Graph of y=a*sin(x)'),xlabel('x'),ylabel('y'),grid
    
    2a

Exercise 3

Plot function y=sinxx y x x for π100x10π 100 x 10 using increments of π100 100

Solution

x = pi/100:pi/100:10*pi;
y = sin(x)./x;
plot(x,y),title('Graph of y=sin(x)/x'),xlabel('x'),ylabel('y'),grid
Figure 1: Graph of y=sinxx y x x
PlotExercise

Exercise 4

Data collected from Boyle's Law experiment are as follows:

Table 1
Volume [cm^3] Pressure [Pa]
7.34 100330
7.24 102200
7.14 103930
7.04 105270
6.89 107400
6.84 108470
6.79 109400
6.69 111140
6.64 112200
Plot a graph of Pressure vs Volume, annotate your graph.

Solution

Pressure=[100330,102200,103930,105270,107400,108470,109400,111140,112200];
Volume=[7.34,7.24,7.14,7.04,6.89,6.84,6.79,6.69,6.64];
plot(Volume, Pressure),title('Pressure Volume Graph'),xlabel('Volume'),ylabel('Pressure'),grid
PV Graph

Exercise 5

The original data collected from Boyle's 1 experiment are as follows:

Table 2
Volume [tube-inches] Pressure [inches-Hg]
12 29.125
10 35.000
8 43.688
6 58.250
5 70.000
4 87.375
3 116.500
Plot a graph of Pressure vs Volume, annotate your graph.

Solution

>> P=[29.125,35,43.688,58.25,70,87.375,116.5];
>> V=[12,10,8,6,5,4,3];
>> plot(V,P),title('Pressure Volume Graph'),xlabel('Volume'),ylabel('Pressure'),grid
PV Graph

Exercise 6

Display the two plots created earlier in one plot.

Solution

PV Graph

Exercise 7

A tensile test of SAE 1020 steel produced the data below 2 experiment are as follows:

Table 3
Extension [mm] Load [kN]
0.00 0.0
0.09 1.9
0.31 6.1
0.47 9.4
2.13 11.0
5.05 11.7
10.50 12.0
16.50 11.9
23.70 10.7
27.70 9.3
34.50 8.1
Plot a graph of Load vs Extension, annotate your graph.

Solution

Extension=[0.00,0.09,0.31,0.47,2.13,5.05,10.50,16.50,23.70,27.70,34.50];
Load=[0.0,1.9,6.1,9.4,11.0,11.7,12.0,11.9,10.7,9.3,8.1];

plot(Extension, Load),title('Load versus Extension Curve'),xlabel('Extension'),ylabel('Load'),grid
LoadVsExtension

Exercise 8

Given below is Stress-Strain data for a type 304 stainless steel. 3 experiment are as follows:

Table 4
Stress [MPa] Strain [mm/mm]
0.0 0.0000
38.6 0.0002
77.2 0.0004
115.8 0.0006
154.4 0.0008
193.0 0.0010
218.0 0.0012
232.0 0.0014
258.0 0.0020
268.0 0.0025
273.0 0.0030
278.0 0.0035
282.0 0.0040
320.0 0.0200
382.0 0.0500
466.0 0.1000
520.0 0.1500
548.0 0.2000
550.0 0.2100
538.0 0.2500
480.0 0.3000
Plot a graph of Stress vs Strain, annotate your graph.

Solution

The data can be entered using Variable Editor:

variables

Then execute the following:

plot(Strain,Stress),title('Stress versus Strain Curve'),xlabel('Strain [mm/mm]'),ylabel('Stress [mPa]'),grid

StressStrain

Footnotes

  1. Introduction to Engineering: Modeling and Problem Solving by J. B. Brockman, John Wiley and Sons, Inc. © 2009, (p.246)
  2. Introduction to Materials Science for Engineers | Instructor's Manual by J. F. Shackelford, Macmillan Publishing Company. © 1992, (p.440)
  3. Introduction to Materials Science for Engineers by J. F. Shackelford, Macmillan Publishing Company. © 1985, (p.304)

Content actions

Download module as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks