Testing Laboratory f23
pdf
keyboard_arrow_up
School
University of Ottawa *
*We aren’t endorsed by this school
Course
1103
Subject
English
Date
Apr 3, 2024
Type
Pages
23
Uploaded by gracejewan
1 Testing and Analysis Laboratory GNG1103 –
Engineering Design
Objective To practice the evaluation of metrics and interpretation of testing results as well as learn the basics of the MATLAB software environment and be able to solve numerical problems. Background MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to-use environment where problems and solutions are expressed in familiar mathematical notation. Typical uses include: Math, computation, algorithm development, modeling, simulation, prototyping, data analysis, exploration, visualization, scientific and engineering graphics, application development, including Graphical User Interface building. MATLAB is an interactive system whose basic data element is an array that does not require dimensioning. This allows you to solve many technical computing problems, especially those with matrix and vector formulations, in a fraction of the time it would take to write a program in a scalar non-interactive language such as C or FORTRAN. The name MATLAB stands for matrix laboratory. MATLAB was originally written to provide easy access to matrix software. MATLAB has evolved over a period of years with input from many users. In university environments, it is the standard instructional tool for introductory and advanced courses in mathematics, engineering, and science. In industry, MATLAB is the tool of choice for high-productivity research, development, and analysis. The MATLAB Language is a high-level matrix/array language with control flow statements, functions, data structures, input/output, and object-oriented programming features. It allows both "programming in the small" to rapidly create quick and dirty throw-away programs, and "programming in the large" to create complete large and complex application programs. Pre-lab Before arriving at the lab, students should review the lab manual and become familiar with the lab setup and procedures. It is highly
recommended to read the first part of Appendix I to understand the basics of MATLAB.
2 Downloads For this lab, you will need access to MATLAB software. If you do not have it installed on your computer, you can access it remotely through the university platform. Below is a link that will guide you through the process of accessing MATLAB. https://www2.uottawa.ca/about-us/information-technology/remote/lab You can find more information about MATLAB in MATLAB official website: https://www.mathworks.com/help/matlab/learn_matlab/ Review Questions What does MATLAB stand for? ______________________________________________________________________________ ______________________________________________________________________________ What are the capabilities of MATLAB? ______________________________________________________________________________ ______________________________________________________________________________ What is the basic mathematical element that MATLAB uses? ______________________________________________________________________________ ______________________________________________________________________________ What is the window called where you type commands? ______________________________________________________________________________ ______________________________________________________________________________ How do you clear the workspace? ______________________________________________________________________________ ______________________________________________________________________________
3 IMPORTANT
: During this lab you will be taking pictures and screenshots. Paste these screenshots in a Word document (or other) as you go through this lab manual so that you can make a PDF document of all your screenshots of your work. SCENARIO:
A new pedestrian bridge must be designed to connect Cummings Island to Riverain Park on the Rideau River. The distance it must cover is approx. 60 m and it must accommodate the width of one maintenance vehicle. It must be able to hold at least 3 kPa of pedestrian load [1]. Assuming the worst Ottawa conditions, it must also be able to withstand hourly wind pressures of 0.41 kPa and a snow load of 2.4 kPa [2]. The City of Ottawa insists that the bridge must be pretty and be the color
s of the Ottawa 67’s
1
. According to pedestrian bridge standards, both the vertical deflection due to pedestrian loading and the horizontal deflection due to wind loading shall not exceed 1/360 of the span length [1]. Deflection refers to the displacement or movement of the bridge structure under the load or weight of traffic, pedestrians, or any other applied forces. There are 7 main types of bridges that could be used: Figure 1: Main types of bridges
2
For the purpose of this lab, scale everything by a factor of 240 and assume a safety factor of 1.5. For example, if we want to know the minimum vertical load that the bridge should be able to hold: ??𝑎?
𝑣
= ???????𝑖𝑎? + ???𝑤 = 3 + 2.4 = 5.4?𝑃𝑎 × 1.5 ?𝑎???𝑦 = 8.1?𝑃𝑎 ÷ 240
= 33.75𝑃𝑎 (??𝑎?? ??𝑎??)
?????
𝑣
= ??𝑎?
𝑣
× 𝑎??𝑎 = 33.75𝑃𝑎 × (
60? ???? × 4? 𝑤𝑖??
240
) = 33.75𝑁 (??𝑎?? ??𝑎??)
1
https://teamcolorcodes.com/ottawa-67s-color-codes/ 2
https://www.engineeringclicks.com/types-of-bridges/
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
4 Part A- Testing Plan 1.
Based on the scenario above, one design specification and target value were developed (see following table). Fill
the following table with two more design specs based on your understanding of the problem. One of the two design specs must be non-functional. a.
Do not use the bridge length as a design specification. Table 1: Design specifications and target values ID Design specifications Relation (=, <, >) Value Units Verification method 1 Vertical load capacity > 33.75 N Test (deflection < 0.7mm) 2 3 2.
Based on the three design specs, plan 3 tests to carry out (one for each spec). Fill
the following table. Note: make sure to look at the available materials and equipment in the lab to use for these tests. Table 2: Test plans Test ID Objective (Why) Description of test method and materials needed (What) Description of results to be recorded (How) Estimated test duration (When) 1 Validating spec 1 2 Validating spec 2 3 Validating spec 3
5 Part B- Data Collection 1.
Based on the tests outlined above, choose
a design for the bridge prototype and it draw out in small scale. You may need multiple prototypes to test different aspects but ideally you can use one for all 3. Show it to your TA or PM for approval. a.
Important: keep the bridge construction within 300mm x 300mm x 150mm. 2.
Construct
the prototype(s) out of the available materials in the lab (do not spend more than 45 mins on this step)
. 3.
Take
a picture of the prototype(s). 4.
Do
the 3 tests outlined in Table 2 by incrementing slowly the values before reaching the target value and record it in the following table. You can add more than 5 data points if you wish. Record
your observations and your results at each step. Table 3: Recoded data Increment Test 1 Test 2 Test 3 x y x y x y 1 2 3 4 5 Part C- Data Analysis Part C.1- General Concepts and Core MATLAB Syntax Read the following parts in Appendix II: MATLAB documentation: ●
Understanding MATLAB interface ●
Working with MATLAB variables ●
Basic commands ●
Working with matrix and scalar operations 1.
Write
three matrices X, Y and Z. X is a 3x3 matrix, Y is a 3x4 matrix and Z is a 4x3 matrix. Print
them in the command Window screen. 2.
Take a screenshot of the Command Window. You’ll use it in your lab report.
6 3.
Clear
the Command Window. 4.
Write
the following code: x = 1:2:30 y = 1:3:30 z = 1:4:30 Question 1. Explain what happens in each case. ______________________________________________________________________________ ______________________________________________________________________________ ______________________________________________________________________________ 5.
Clear
the Command Window. 6.
Considering three matrices A = ‘Faculty’, B = ‘of’ and C = ‘engineering’. Find a way to print
in the command window the text: “Faculty of engineering”. Think back to th
e Spreadsheet lab where you needed to combine a first and last name. *Note: spaces only work at the start of a string of text and not at the end. 7.
Take
a screenshot of the Command Window. You’ll use it in your lab report.
8.
Clear
the Command Window. 9.
Write
two other matrices Y and Z where: 2 1 4 2 3 6 Y = 3 2 1 Z = 1 5 7 1 4 3 3 4 1
10.
Using MATLAB, perform
the following operations: T = Y+Z U = Y-Z V = Y*Z W= Y.*Z 11.
Take
a screenshot of the Command Window. You’ll use it in your lab report.
Question 2. What is the difference between V and W? ______________________________________________________________________________ ______________________________________________________________________________ ______________________________________________________________________________ Question 3. What is the value in matrix T corresponding to row 3 column 2? Write your answer, as well as the MATLAB syntax used to access this index. ______________________________________________________________________________
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
7 Question 4. What does typing W(:,2) into the Command Window and hitting enter give you? Explain what the colon does when accessing indices. ______________________________________________________________________________ Part C.2- Testing Results Read the following parts in Appendix II: MATLAB documentation: •
Control flow •
Creating basic plots •
Adding annotations 1.
Open
a new script. 2.
Write
the following code: x = -20:2:20; y = (x.^2); plot(x,y) 3.
Run it
and observe the graph. 4.
Add
some information to your graph: x axis, y axis and a title. 5.
Take
a screenshot of the graph. You’ll use it in your lab report.
6.
Enter
the data you collected in part B in variables for the first test by writing the x and y data in 2 matrices of length N, N being the number of increments used when collecting data (ex: Test1_x = [1; 2; 3; 4
;…; N
] and Test1_y = [1; 2; 3; 4
;…; N
]). 7.
Adjust
the plot labels accordingly. 8.
Run
the code. 9.
Take
a screenshot of the graph. 10.
Repeat steps 6-9 for the other two tests. Question 5. Explain the graph results and if the tests were successful.
______________________________________________________________________________ ______________________________________________________________________________ ______________________________________________________________________________
8 Question 6. What do the results represent compared to your target specifications and what changes might you have to do to improve your prototype? ______________________________________________________________________________ ______________________________________________________________________________ ______________________________________________________________________________ ______________________________________________________________________________ ______________________________________________________________________________ Submission Submit this lab manual as a printed PDF with the answers to the questions on the lines in this document by uploading to Brightspace before the due date. You must also include the PDF document with your screenshots in your submission. All uploaded files must be submitted as one submission with many uploads, not many individual submissions. References [1] A. de la Chevrotière and L. Gérin, "A Review of Two Codes For the Design of Pedestrian Bridges," 2021. [Online]. Available: https://maadigroup.com/wp-
content/uploads/2022/10/MAADI_Group_Review_of_2_codes_R3.pdf. [Accessed 18 2 2023]. [2] Dlubal, "Load zones for snow, wind, earthquake," [Online]. Available: https://www.dlubal.com/en/load-zones-for-snow-wind-earthquake/snow-nbc-
2020.html#¢er=45.427105896042356,-
75.64542997176247&zoom=13&marker=45.4321656075918,-75.671007516928. [Accessed 18 2 2023].
9 Appendix I: Quantitative vs Qualitative tests Quantitative tests and qualitative tests are two distinct approaches used to gather and analyze data in research, evaluation, and various fields. The main difference between them lies in the type of data they generate, and the methods used for data analysis. Quantitative Tests: Quantitative tests are designed to collect and analyze numerical data. These tests aim to quantify variables and provide statistical insights to understand patterns, relationships, and trends within the data. The data obtained from quantitative tests are typically expressed in numerical form and can be further subjected to statistical analysis. •
Examples of quantitative tests: o
Speed Test: The engineer measures the time taken by the scraper to move a specific distance, such as from one end of the construction site to the other. The data collected is the average speed of the scraper, expressed in kilometers or miles per hour. o
Experiments: In experimental research, data collected through measurements (e.g., height, weight, time) are quantitative and can be analyzed statistically to determine if there are significant differences between experimental groups. o
Fuel Efficiency Test: The engineer records the amount of fuel consumed by the scraper during a fixed period of operation. They measure the fuel consumption in liters or gallons per hour, providing a quantitative measure of its efficiency. Qualitative Tests: Qualitative tests are used to collect non-numerical data to gain insights into people's thoughts, opinions, feelings, or behaviors. These tests focus on understanding the context, meanings, and interpretations of the data. Qualitative data often come in the form of text, images, audio, or video recordings. •
Examples of qualitative tests: o
Observational Study: The engineer observes the scraper in action on the construction site, noting how well it maneuvers, handles loads, and copes with different terrains. They may also observe the operator's body language to gauge their comfort and confidence. o
Comparative Analysis: The engineer compares the scale scraper's performance with similar models or other types of earthmoving equipment used on the construction site. This qualitative assessment helps in identifying the scraper's unique advantages and limitations. o
Content analysis: Analyzing textual or visual content to identify themes, patterns, and meanings, such as analyzing open-ended survey responses or media content.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
10 Appendix II: MATLAB documentation This document contains all the information necessary to answer the questions of the laboratory. Understanding the MATLAB interface When you open MATLAB for the first time, you will see that the interface is divided into four windows. On the left, the current folder window. This is where all relevant MATLAB files are placed in the folder where you are. But it's also where all the functions and scripts you create will be stored. It is important to ensure that you are in the right folder when you execute scripts and functions because MATLAB will consider the active folder for the purpose of performing functions. By default, MATLAB will define the current folder in a folder named MATLAB in your Documents folder. In the middle of the screen is the command window.
11 This area contains all your inputs and outputs when you perform various functions. Whenever you execute a script or function, any output will be displayed here. Technically, the command window has all the same functions as the script editor. Thus, it is possible to write programs directly on this line. However, in practice, you will probably want something that you can record, edit, and run multiple times. At any time, if the command window becomes too cluttered, you can delete it by typing clc and pressing Enter, or by clicking the arrow in the upper-right corner of the tile and choosing Clear Command Window. At the bottom left of the screen is the workspace.
12 It contains a list of all the active variables in your simulation. To modify the information available on your variables, right-click on the columns and select the information you want to display. The workspace displays all the variables you used in a given MATLAB session, regardless of the script or function they came from. So, after a while, it can be cluttered with old data. To clean the workspace, click the drop-down arrow at the top right of the Workspace screen and choose Clear Workspace. After confirming, MATLAB will delete all existing variables. Working with MATLAB variables Let's take a look at how to create and manipulate basic MATLAB variables. For starters, we are going to need some variables. For now, we will use the simplest method of creating variables, by typing in the command window. Defining a new variable in MATLAB is very easy. Unlike other programming languages like C or Java, you do not need to add a variable declaration statement. In other words, you do not need to tell MATLAB anything like, this variable is an integer, or this variable is a string. Instead, all you need to do is tell MATLAB what your variable is equal to, so you can do it now. In the command window, type A equal to 1 and press Enter. The command window (Command Window) makes you the result A is equal to 1. The workspace now displays a new variable called A with a value of 1 and a size of 1 by 1. That says just that A is a scalar. MATLAB also supports variables that are vectors or matrices. To create a vector in your variable declaration, place brackets around your term and separate each value in square brackets with a
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
13 comma or space. For example, C = [1 2 3] causes C to be created as a vector one by three with the three values stored there. To create a matrix, the same principle applies, except that you use a semicolon to separate the lines. For example, D = [1,2; 3,4] causes D to be created as a 2 by 2 matrix with these values. Basic commands To set variables as text rather than a numeric value, place single quotation marks around the text that you define. If you want your string to be variable rather than fixed, the functions num2str and strcat will be useful. num2str converts a numeric value into a string, which adds a non-
predetermined number to the string. Strcat concatenates two strings strictly to form a longer string.
14 Unlike Java, MATLAB does not require you to place a semicolon at the end of each line. If you do, MATLAB will interpret it as a command to suppress the output for everything that happens on the previous line. This is an extremely useful feature, because by default, MATLAB displays the results of each function, equation, variable definition, or loop during the program. For larger scripts, this can quickly overwhelm the command window and make the program unusable. In general, unless you specifically want to see the output of a line, it is good practice to end each line with a semicolon. Working with matrix and scalar operations Let's take a look at the basic matrix operations used by MATLAB. Since MATLAB treats all variables as if it were a matrix, it is important to distinguish between operations such as the multiplication of the matrix with respect to multiplication of the scalar. We will practice different types of matrix operations. Let's use the matrices below:
15 To begin, type a + b in the command window. Since the matrix a and the matrix b have the same dimension, MATLAB will interpret it as piecewise addition and simply add the corresponding values in each cell of the matrices.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
16 On the other hand, if you type a + 2, MATLAB will interpret this as a scalar addition, so that it will add two to each cell in A. The same principle applies to the multiplication of matrices. If we enter c * d, MATLAB sees that these two variables are matrices, and their internal dimensions correspond (the number of columns of c is equal to the number of lines of d). So, it will automatically perform the matrix multiplication. On the other hand if you type c * 2 MATLAB considers 2 as a constant and multiplies each term in c by 2. Matrix multiplication is a fairly straightforward process. But what if we wanted MATLAB to perform a piecewise multiplication of the corresponding matrix entries. Matrices a and b have the same dimensions, but if you enter just once b, MATLAB does not know that we want to multiply the corresponding entries. So, it assumes that we want to multiply the matrices and display an error
17 because the inner dimensions of these two matrices do not match. Instead, we can add a dot in front of the asterisk. Adding a point in front of any operation, addition, subtraction, multiplication, division, exponents or even equality, tells MATLAB to execute the operation in pieces. This is a really effective way to handle large amounts of data at a time. Control flow Creating a new program is easy. Just click the New Script button to generate the script and automatically open the Script Editor window. Here you can type any code that will be executed as part of the program. For example, we will simply create a very simple script that generates a two by three random matrix. So P = rand (2,3). When you are ready to save, click the Save button and give the program a name and it will automatically save to the active folder.
18 Now, every time you want to go back to the script to edit it, just double-click on the name in the current folder pane and this will reopen the window and allow editing the script exactly as before. To run the program, there are several different options. You can first click the Run button in the edit window. This runs the program immediately without closing the window, allowing you to quickly and easily see how changes made to the program affect the output. Second, you can right-click on the script from the current folder window. And choose Run or press F9.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
19 Creating basic plots Let's look at ways to display data in MATLAB. The basic function for drawing a two-dimensional graph in MATLAB is the plot function. There is a wide variety of syntax for this function, allowing you to change many of the parameters as you create it. The simplest plot takes a single data vector and plots the data values against the number of indexes of the data in the vector: plot (x, y) Adding annotations To add information on a graph like the title, the axes, ... just type the functions xlabel, ylabel and title followed by the information to enter.
20
21 Appendix III: Introduction to matrices A matrix
is a rectangular arrangement of numbers into rows and columns. For example, matrix A has two rows
and three columns
. Matrix dimensions The dimensions of a matrix tells its size: the number of rows and columns of the matrix, in that order. Since Matrix A has two rows and three columns, we write his dimension as 2x3. In contrast, matrix B has 3 rows and 2 columns so it’s a 3x2 matrix. Matrix elements A matrix element is simply a matrix entry. Each element in a matrix is identified by naming the row and column in which it appears. For example, consider matrix G: The element G(3,1) is the entry in the 3 row and first column which is -20
Matrix Operations • Addition
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
22 To add two matrices of the same dimensions, simply add the entries in the corresponding positions. Remember, the matrices need to have the same dimension, which means the same number or rows and columns. Example: • Multiplication
a) Scalar by matrix The term scalar multiplication refers to the product of a real number and a matrix. In scalar multiplication, each entry in the matrix is multiplied by the given scalar. b) Matrix Multiplication (i.e. product of two matrices) Matrix multiplication refers to the product of two matrices, which is not the same as multiplying a matrix with a scalar number. You can multiply two matrices if, and only if, the number of columns in the first matrix equals the number of rows in the second matrix. Otherwise, the product of two matrices is undefined. The product matrix dimensions are: (rows of first matrix) × (columns of the second matrix) As examples, we can multiply a 2×3 matrix with a 3×1 matrix and the resulting product matrix will be 2×1.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
23
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help