Inside Collection (Textbook): A Brief Introduction to Engineering Computation with MATLAB

Summary: Problem Set for MATLAB Essentials

Determine the value of each of the following.

`>> (6*7)+4^2-2^4`

(ans = 42)

`>> ((3^2+2^3)/(4^5-5^4))+((sqrt(64)-5^2)/(4^5+5^6+7^8))`

(ans = 0.0426)

`>> log10(10^2)+10^5`

(ans = 100002)

`>> exp(2)+2^3-log(exp(2))`

(ans = 13.3891)

`>> sin(2*pi)+cos(pi/4)`

(ans = 0.7071)

`>> tan(pi/3)+cos(270*pi/180)+sin(270*pi/180)+cos(pi/3)`

(ans = 1.2321)

Solve the following system of equations:

```
>> A=[2 4; 1 5]
A =
2 4
1 5
>> B=[1; 2]
B =
1
2
>> Solution=A\B
Solution =
-0.5000
0.5000
```

Evaluate y at 5.

```
>> p=[4 0 3 -1 0]
p =
4 0 3 -1 0
>> polyval(p,5)
ans =
2570
>>
```

Given below is Load-Gage Length data for a type 304 stainless steel that underwent a tensile test. Original specimen diameter is 12.7 mm. 1

Load [kN] | Gage Length [mm] |
---|---|

0.000 | 50.8000 |

4.890 | 50.8102 |

9.779 | 50.8203 |

14.670 | 50.8305 |

19.560 | 50.8406 |

24.450 | 50.8508 |

27.620 | 50.8610 |

29.390 | 50.8711 |

32.680 | 50.9016 |

33.950 | 50.9270 |

34.580 | 50.9524 |

35.220 | 50.9778 |

35.720 | 51.0032 |

40.540 | 51.816 |

48.390 | 53.340 |

59.030 | 55.880 |

65.870 | 58.420 |

69.420 | 60.960 |

69.670 (maximum) | 61.468 |

68.150 | 63.500 |

60.810 (fracture) | 66.040 (after fracture) |

Compute the stress and strain values for each of the measurements obtained in the tensile test. Data available for download.

First, we need to enter the data sets. Because it is rather a large table, using Variable Editor is more convenient. See the figures below:

Next, we will calculate the cross-sectional area.

```
Area=pi/4*(0.0127^2)
Area =
1.2668e-004
```

Now, we can find the Stress values with the following, note that we are obtaining results in MPa:

```
Sigma=(Load_N./Area)*10^(-6)
Sigma =
0
38.6022
77.1964
115.8065
154.4086
193.0108
218.0351
232.0076
257.9792
268.0047
272.9780
278.0302
281.9773
320.0269
381.9955
465.9888
519.9844
548.0085
549.9820
537.9830
480.0403
```

For strain calculation, we will first find the change in length:

```
Delta_L=Length_mm-50.800
Delta_L =
0
0.0102
0.0203
0.0305
0.0406
0.0508
0.0610
0.0711
0.1016
0.1270
0.1524
0.1778
0.2032
1.0160
2.5400
5.0800
7.6200
10.1600
10.6680
12.7000
15.2400
```

Now we can determine Strain with the following:

```
Epsilon=Delta_L./50.800
Epsilon =
0
0.0002
0.0004
0.0006
0.0008
0.0010
0.0012
0.0014
0.0020
0.0025
0.0030
0.0035
0.0040
0.0200
0.0500
0.1000
0.1500
0.2000
0.2100
0.2500
0.3000
```

The final results can be tabulated as foolows:

```
[Sigma Epsilon]
ans =
0 0
38.6022 0.0002
77.1964 0.0004
115.8065 0.0006
154.4086 0.0008
193.0108 0.0010
218.0351 0.0012
232.0076 0.0014
257.9792 0.0020
268.0047 0.0025
272.9780 0.0030
278.0302 0.0035
281.9773 0.0040
320.0269 0.0200
381.9955 0.0500
465.9888 0.1000
519.9844 0.1500
548.0085 0.2000
549.9820 0.2100
537.9830 0.2500
480.0403 0.3000
```

- « Previous module in collection Essentials
- Collection home: A Brief Introduction to Engineering Computation with MATLAB
- Next module in collection » Plotting in MATLAB