Pre-Lab



Successful completion of this project will enable you to:

• Gain more experience using MATLAB with the focus being on:

o The use of control and conditional structures

o The creation of an executive program and user-defined functions

• Continue to create plots of technical presentation quality

• Practice applying statistical analysis concepts

• Apply MATLAB skills to a problem based on a real-world situation

• Continue to develop effective teaming skills

[pic]

PROJECT DESCRIPTION

Liguore Labs has analyzed your team's work thus far in determining roughness from nanoscale images. Kerry Prior has asked your team to develop a program in MATLAB that allows a user to calculate roughness of a nanoscale sample by several methods available. You have read how an AFM works, and Liguore Labs wants a method to visually display AFM datasets and calculate roughness using methods that are accepted within the industry. To satisfy the company's needs, your team must design a program that is functional and easy to use. In addition to developing the software tool, your team will document your procedures and demonstrate how your software tool can be used on a series of AFM data files. Your document must be written in complete sentences and should clarify the program completely, yet briefly, for your client. Your software tool will be viewed and evaluated by the managers at Liguore Labs. You may assume that the managers have some knowledge of science and math but are NOT engineers.

[pic]

BACKGROUND INFORMATION

In Homework 11, you learned to use AFM data to make a digitized, grayscale image as in Figure 1. Note that this is not a picture of the surface, and you should not use "photograph" or "picture" in your report. These are digital "images" in which the brightness value of each pixel represents height. Figure 1 can be stored in MATLAB as a variable that contains an array of numbers, with each number referring to the gray scale value for each pixel of the image. A sub-sample of the complete Figure 1 file is shown in Table 1; this sub-sample shows the gray scale values for the square superimposed on Figure 1 and magnified by itself in Figure 2. Gray-scale values can range from 0 for black to 255 for white (as they do in Figure 1). You will place a line over this table of data, by choosing two random points to define the endpoints. This line can be horizontal, vertical, or at an angle. An example of a possible line is shown on the table as the underlined values (though it is not shown on the actual figure, to avoid obscuring the pixels that are used). You will determine gray values so you can make an image that acts like a "topographic map" of your AFM data, that will provide a visual representation of "depth".

[pic] [pic]

Figure 1. Image made from AFM height data, with Figure 2. Close-up of area pixel color representing height at each location. outlined in Figure 1, to show

(Remember that this is not a photograph.) pixels and brightness.

Table 1. Digital file for sub-sample from AFM image shown in Figure 2, with possible angled line shown by underlined numbers. Note the dark "hole" in the middle of values < 100.

|196 193 187 180 173 165 153 149 145 138 133 131 129 128 129 131 134 135 137 136 |

|193 192 188 183 177 166 155 151 147 142 137 135 131 129 130 130 130 131 134 137 |

|195 189 188 183 175 169 162 151 146 145 140 136 134 132 130 129 130 131 131 131 |

|195 189 189 185 180 178 171 157 152 152 144 141 139 134 129 128 129 127 128 130 |

|206 203 200 190 184 180 173 164 157 149 143 142 138 132 130 129 129 129 129 128 |

|205 203 195 185 183 180 173 170 163 149 141 140 139 137 135 134 129 128 128 127 |

|208 205 195 185 182 175 169 169 162 149 144 143 140 139 137 134 128 128 127 126 |

|207 203 195 189 184 174 168 166 158 146 142 139 134 134 134 131 128 127 126 125 |

|203 201 196 191 183 171 161 158 149 141 138 135 132 130 128 124 124 125 122 120 |

|196 193 191 189 182 166 149 145 141 137 135 132 128 126 127 125 124 123 121 118 |

|192 186 179 176 172 157 143 138 127 124 132 133 126 123 123 120 118 120 118 116 |

|183 181 176 173 165 146 131 132 126 121 125 123 114 108 107 107 109 110 111 112 |

|184 180 173 170 167 155 138 128 118 109 112 109 102 102 103 105 107 107 105 103 |

|180 178 169 164 161 148 130 119 112 102 98 98 99 101 102 102 104 104 105 103 |

|176 172 163 158 157 143 126 119 113 107 102 99 100 102 102 103 103 103 103 102 |

|168 156 148 146 137 128 125 123 120 116 112 110 105 102 104 105 105 105 105 103 |

|155 144 130 133 132 124 125 125 124 122 119 117 113 110 110 111 111 110 108 105 |

|161 155 146 136 132 122 122 124 123 124 125 125 125 119 114 114 113 112 110 108 |

|155 140 125 120 120 120 120 121 125 129 131 132 133 131 127 121 117 115 112 110 |

|205 197 192 179 165 162 152 138 138 140 136 137 141 137 130 127 122 118 115 113 |

|220 220 219 215 209 201 192 182 174 165 154 146 145 145 141 137 134 131 126 123 |

|213 215 216 217 217 217 215 210 205 203 198 191 186 181 176 172 165 155 145 140 |

|209 209 212 213 214 215 217 217 217 217 215 215 215 208 204 200 190 179 174 164 |

|202 205 208 208 209 211 214 214 214 215 216 217 217 216 214 210 204 198 191 183 |

|205 207 207 207 209 207 207 209 211 211 211 212 214 214 213 213 211 210 206 202 |

|210 210 210 208 209 208 209 210 209 209 208 210 210 210 211 211 211 209 207 206 |

|213 208 207 207 208 208 208 209 210 211 212 210 208 208 208 206 205 206 205 204 |

|216 214 211 208 209 208 208 210 213 214 214 213 212 211 209 207 206 205 203 201 |

|216 215 215 214 214 213 211 213 214 213 211 210 209 209 209 209 208 207 204 203 |

|211 214 216 216 218 220 219 217 216 216 214 210 209 210 209 208 207 206 206 206 |

[pic]

MATLAB Code

Executive Function

Your code will consist of a MATLAB executive program and a series of supporting MATLAB user-defined functions. An executive user-defined function is the main function that controls the overall order of computations and operations. This function has no input or output arguments. Your team will construct one executive user-defined function called nanorough.m which will control the order of the computations and calls to user-defined functions. For the duration of Project II, your team will add and modify sections of this function as you complete the supporting user-defined functions. This function is to execute when nanorough is entered at the MATLAB prompt. It will make calls to the supporting user-defined functions that your team creates. You will begin building the executive function in Lab 12, though you will have developed some of the supporting user-defined functions in Lab 11. In Part A, you will be writing introductory code that finds the height values needed to perform the roughness calculation. In Part B, you will be given information about the different formulas used to calculate roughness and will implement these calculations.

Supporting User-Defined Functions

Your team will construct user-defined functions that will perform the computations for the project. The executive function should route appropriate information to and from user-defined functions but perform minimal computations itself. All major computations (such as defining the endpoints of the line) and repetitive computations (such as converting height values to color values or finding the values of brightness along the line) must be handled by user-defined functions. A good rule-of-thumb is to create a user-defined function for any task or computation that takes more than 8 lines of code. Clearly indicate the author(s) of each function. There should be clear evidence that each member is contributing to the development of project code.

Required Functionality of Code

When the user of your code types nanorough at the MATLAB prompt, the user should be kept in the program until the user wishes to quit. This means that the user can continuously run AFM datasets without being forced to restart the program. Your team will work on this in Lab 12.

Your code must be able to load an ASCII AFM dataset. Your code must also be general enough to handle any AFM dataset with X, Y, and height data in three columns. Your team will construct this piece of the project in Homework 11. During demonstrations of your code, your team will be asked to develop an image of a dataset your team has never seen before (though it will be of the same style as those you have used while developing your project).

Sample Images and Determination of Pixel Color Value

Three AFM datasets are provided for use by your team. The digitized files are called gold24.txt, afm2.txt, and afm3.txt and located in the engr106/FALL2003/PROJECTS subdirectory. Each dataset will be loaded and converted to an array of numbers. This will be covered in Homework 11. Each number in the array represents the height at the particular point. You will normalize this data to find a gray scale value for each pixel. These values range from 0 for black to 255 for white. Each of these 256 colors will represent a small range of heights.

Thus, you will have two data arrays. The first, the Height Data Array, contains the height values for each point that will be used in all your calculations (most of which will be performed in Part B). The second array, the Pixel Color Array, will have the same number of rows and columns as the Height Data Array, but will have been "proportioned" or "normalized" to contain integer values between 0 and 255 and will be used as a visual representation to help the user "see" the roughness of the surface. This image will be Plot 1.

Random Lines

Each line is defined by a starting point and an ending point. The points must be randomly placed on the image. Your team will begin work on random generation of points in Lab 11, and will continue this in Labs 12 and 13 and Homework 12.

Average Height

Each pixel along the line will have a height value. You will calculate the average height of these points. You will plot the height at each point along the line as well as the average height. Refer to Question 7 of Homework 10. Your Plot 2 will look like the "Cross Section" plots.

Required Output Results

Your code should generate results that are easy to interpret. Graphical results are to include plots:

• Plot 1 is a figure showing the image made from the AFM data with all lines (though you are only required to have one for Part A) used to determine the roughness overlaid on the image.

• Plot 2 is a figure showing the height of each pixel along the line. It must be properly labeled and should display a line showing the average height (which is not shown on the plots in Homework 10, but is needed for calculations required for Part B).

Additionally, a series of text-based key results must be displayed on the screen. These include:

• All user inputs (e.g., dataset name).

• All internally-measured values (e.g., size of dataset array, maximum and minimum height values).

• All internally-calculated values (e.g., "height resolution" of image – the height difference between two pixels that differ by 1 out of the 256 shades of gray, the average height).[pic]

REPORTS

Your team will demonstrate the team's nanorough initial code in lab. Your code should be able to provide initial results (described below) for an AFM dataset never seen before. Your TA will select one team member to display the code, which is why every member should have access to the code and understand it. This demonstration will form part of the grade for Part A.

Further, your team will submit an interim project report that includes the following items.

Executive Summary. Write a one-page (1.5 spacing) executive summary to the managers of the Liguore Labs. The summary must include a description of your methodology for finding color values based on the AFM dataset and for finding the "addresses" of points (or pixels) that fall along the random line. The description should include enough detail for the manager of Liguor Labs to understand how the images are generated, what these images show, how the line is used, and what the "average" height represents Many of the calculations for Part B will be based on deviations from this "average" line. Also discuss the capabilities of MATLAB that make it useful for this type of analysis, as well as any shortcomings of MATLAB for this application that you may have identified. This should be written in the form of a memorandum as follows:

MEMORANDUM

To: Kerry Prior, Vice President of Research, Liguore Labs

From: Team #: List all members of your team

Re: AFM Roughness MATLAB Tool - Interim Report

Date:

Flow Chart(s). Draw one or more flowcharts to track the calculation of the pixel colors from the AFM height dataset, calculate the average height, and other tasks as necessary. These should be easy for the TA to follow. They may be neatly handwritten or electronic – PowerPoint provides flowcharting capability, though you are allowed to do these by hand, which might be faster.

Code and Documentation.

• Provide a typed list of all the functions that your team has written for Part A of the Project. For each function on the list, include the name of the function, the author(s), and a brief description of what the function does. Provide a description of the inputs and outputs. Note that most of this information is to be included in the help comments of each function.

• Submit a hard copy of each function written for Part A. Be sure the correct file name appears on each page. Adequately comment your code so your TA can easily follow your code.

Initial Results.

At the end of Part A, your code should do the following (and you will test that your code can develop these results on two of the three AFM datasets provided and submit your results):

• Convert a raw AFM height dataset into an image

• Generate one random line on the image

• Calculate the average height for the chosen line

• Display Plot 1 and Plot 2 to the screen in a single figure window using the subplot command

• Display to the screen the name of the AFM dataset being analyzed. Display all user inputs, assumed values, and key results that were required as part of the calculation.

Your team will also submit a copy of the output printed to the screen by creating two diaries: one for each of two (out of the three) sample AFM datasets (use the diary command in MATLAB). Please suppress printing of all computation lines before running your simulation so that the diary will not be too long. Otherwise, trim extraneous lines in the diary text file before printing the hard copy. Your output should clearly indicate which dataset is being analyzed.

Successful completion of this project will enable you to:

• Gain more experience using MATLAB with the focus being on:

o The use of control and conditional structures

o The creation of an executive program and user-defined functions

• Continue to create plots of technical presentation quality

• Practice applying statistical analysis concepts

• Apply MATLAB skills to a problem based on a real-world situation

• Continue to develop effective teaming skills

[pic]

PROJECT DESCRIPTION

Liguore Labs is ready for your finished MATLAB code to calculate roughness of a nanoscale sample by several methods available. You have read how an AFM works, and Liguore Labs wants a method to visually display AFM datasets and calculate roughness using methods that are accepted within the industry. To satisfy the company's needs, your team must design a program that is functional and easy to use. In addition to developing the software tool, your team will document your procedures and demonstrate how your software tool can be used on a series of AFM data files. Your document must be written in complete sentences and should clarify the program completely, yet briefly, for your client. Your software tool will be evaluated by the managers at Liguore Labs, who have knowledge of science and math but are not engineers.

[pic]

Roughness Calculations: (based on appnotes/AN505.pdf)

[pic]

The following methods of measuring roughness are generally accepted in the industry:

|Term |Definition |Calculation |Use |

|[pic] |Mean of height values of all heights along |[pic] |This is a starting point for many of the |

| |profile (where "profile" is the line you draw) | |other calculations |

|[pic] |Roughness Average of the profile is the |[pic] |This simple method is often used to describe |

| |difference between each point and the average | |the roughness of machined surfaces. |

| |height | | |

|[pic] |Root Means Square Average of the profile is |[pic] |This more complicated method is ~1.11*Ra for |

| |similar in concept to linear regression | |many surfaces, but not always |

|[pic] |Maximum profile peak height, Maximum profile |Measured |Measure of highest and lowest points |

| |valley depth | | |

|[pic] |Maximum Height of profile is difference between |[pic] |Range of highest and lowest points |

| |peak and valley | | |

|[pic] |Average Profile is the average found from the |[pic] |See picture and discussion below to define a |

| |five greatest peaks and five greatest valleys. | |maximum peak and valley |

|[pic] |Skewness measures the assymetry of the profile |[pic] |Used with a histogram (Plot 3) to show if |

| |about the mean line. | |heights are normally distributed |

| |Positive skew indicates a predominance of peaks, while negative skew indicates a predominance of valleys. |

Note that a peak, such as P1, prevents any other points on that "mountain" from being a peak until the height has gone below [pic] in both directions. Note this is also true of valleys (see V2, with a "local" valley just to the left of V2 that is not used). The label Rz has been used for other roughness measures, so you might find other equations if you search the Internet; use this one.

The following image is provided only to help you see what skewness and the Rsk value indicate. Note that the ADF (Amplitude Distribution Function) is a histogram of all the heights. Again, you do not need to develop a figure like the one shown here. However, you will develop a histogram similar to the ADF curve (rotated 90º) as Plot 3 (discussed in “Required Output Results”). To make this curve reasonably smooth, you will likely have 30 or more bins.

[pic]

[pic]

MATLAB Code

Executive Function

Your code will consist of a MATLAB executive function and a series of supporting user-defined functions. The executive function, called nanorough.m, will control the order of computations and calls to user-defined functions. This function is to execute when nanorough is entered at the MATLAB prompt. The executive function should route appropriate information to and from user-defined functions but perform minimal computations itself.

Supporting User-Defined Functions

Your team will construct user-defined functions that will perform the computations for the project. In the "Roughness Calculations" section above, you have been given information about the different formulas used to calculate roughness and will implement these calculations. For additional information, visit tech/spm/profile.pdf (particularly pages 6-7, 11-13, 33-37, and 41-42). Much of this site is based on smg/parameters.htm). All major computations (such as defining the endpoints of the line or solving the roughness equations) and repetitive computations (such as converting height values to color values or finding the five peaks and valleys) must be handled by user-defined functions. A good rule-of-thumb is to create a user-defined function for any task or computation that takes more than 8 lines of code. Clearly indicate the author(s) of each function. There should be clear evidence that each member is contributing to the development of project code.

Required Functionality of Code

When the user of your code types nanorough at the MATLAB prompt, the user should be kept in the program until the user wishes to quit. This means that the user is to be allowed to run one AFM dataset after another, after another without being forced to restart the program.

Your code must be general enough to load any AFM dataset with X, Y, and height data in three columns. During the final demonstration of your code, your team will be asked to calculate roughness of a dataset your team has never seen before (though it will be of the same style as those you have used while developing your project).

Random Lines

Each line is defined by a starting point and an ending point that allows at least 200 data points to be found between them. The starting and ending points must be randomly placed on the image.

User Choice of Parameter

The user should be given a choice of which roughness value will be found. The user should also be given the choice to find all measurements at once, if desired, rather than having to choose all of them one by one. Once the user makes a selection, the MATLAB code should calculate that value and display it to the screen. As soon as the user enters a name of an AFM dataset, Plot 1 should appear. When the user chooses any of the measurements, Plots 1 and 2 should appear in a single figure using the subplot command. If the user chooses to find the skewness, Plots 1 and 3 should appear in a single figure. If the user chooses to see all calculations, then Plots 1, 2, and 3 should appear in a single figure. (Plots are discussed in “Required Output Results” below.)

Consistency and Reliability

"Consistency" is the sameness of parts of the whole. Some AFM datasets are "consistent", in that if you are calculating Rz, and you place seven random lines on your data, you get similar values for each of the seven lines. The roughness measure is similar over each measured part. Other datasets will be highly variable, in that a line placed in one location will result in a very different roughness value from another line, and could be called "inconsistent". It is up to your team to define “similar”. You should discuss the concept of consistency of the datasets in your summary.

"Reliability" is defined as an ability to collect the same results on repeated trials. The roughness calculation made for a single line may not be a good representation of the dataset since there may be a high degree of variability depending on where the line is superimposed on the dataset. To get high reliability, several lines with different starting and end points should be used on the dataset. Your team will decide how many lines are needed to attain "reasonable reliability" of the roughness for a given dataset. To do this, your team will need to come to a consensus on what constitutes "reasonable reliability".

If you take readings on seven lines, it may not make sense to average those seven readings. You might choose to use the mode roughness value (which is difficult with continuous values; how many decimal places are appropriate for your roughness value?), a trimmed mean where you drop the highest and lowest values (or three highest and three lowest values), or some method other than simple arithmetic average. Develop a procedure for determining roughness values that ensures that your measurements on a dataset meet your team's definition of "reasonable reliability." Implement your procedure in your project code - your team will need to decide what results need to be presented to the user. Discuss your analysis of reliability in your report. Consistency and reliability are related topics, so there may be an amount of overlap in your discussion of each topic.

Required Output Results

Your code should generate results that are easy to interpret. Graphical results are to include plots:

• Plot 1 is a figure showing the image made from the AFM data with all lines used to determine the roughness overlaid on the image.

• Plot 2 is a figure showing the height of each pixel along the line. In Part A, the x-axis showed pixels along the line; for Part B, the x-axis should show the actual distance in nanometers along the line. Use proper labels and display a line showing the average height.

• Plot 3 is a histogram of the height values found for one of the lines used, with approximately 30 bins and with bin edges defined to help illustrate the skew of the roughness value.

Additionally, a series of text-based key results must be displayed on the screen. These include:

• All user inputs (e.g., dataset name).

• All internally-measured values (e.g., size of dataset, maximum and minimum height values, reliability related measured values).

• All internally-calculated values (e.g., "height resolution" of image – the height difference between two pixels that differ by 1 out of the 256 shades of gray, the average height, the computed roughness value(s) desired by the user, reliability related calculated values).

[pic]

REPORTS

Your team will demonstrate the team's nanorough code in lab. Your code should be able to provide full results (described below) for an AFM dataset never seen before. Your TA will select one team member to display the code, which is why every member should have access to the code and understand it. This demonstration will form part of the grade for Part B.

Further, your team will submit a final project report that includes the following items.

Executive Summary. Write maximum three-page (1.5 spacing) executive summary to the managers of the Liguore Labs. The executive summary should include:

• A brief description of the problem your team is solving and an explanation of why methods for measuring nanoscale roughness are important/useful.

• Your team must include a paragraph that discusses why there are so many roughness measures, i.e., why a single roughness measure will not work for all datasets. You may wish to refer to the datasets you were provided.

• A discussion of consistency and/or reliability in general terms. You may certainly refer to the three datasets provided, but do not discuss consistency and reliability in terms of those three images only; your discussion should be general so it would be useful for the managers as they look at other datasets.

• A brief response to any problems that were noted on Part A of the project (e.g. clarify missing or unclear material).

• A 1-2 paragraph description of the functionality and use of the program you have developed. The description should include enough detail for the manager of Liguor Labs to understand what a "roughness" value indicates about the surface, as well as what "skewness" represents and how to read your histogram. Your description should note how your team had chosen to define consistency and a procedure for how it is achieved in the determination of roughness measures.

• A comparison of two of the provided datasets; results should be presented in table format. (The table will not count towards your three page limit).

Write the summary in the form of a memorandum as follows:

MEMORANDUM

To: Kerry Prior, Vice President of Research, Liguore Labs

From: Team #: List all members of your team

Re: AFM Roughness MATLAB Tool - Final Report

Date:

Flow Chart(s). Draw one or more flowcharts to track allowing the user to choose the desired calculation, finding the five peaks and valleys, or other important code functionality.

Code and Documentation.

• Provide a typed list of all the functions that your team has written for the Project. For each function on the list, include the name of the function, the author(s), and a brief description of what the function does. Provide a description of the inputs and outputs. Note that most of this information is to be included in the help comments of each function.

• Submit a hard copy of each function written for Part B. Be sure the correct file name appears on each page. Adequately comment your code so your TA can easily follow your code.

Final Results.

At the end of Part B, your code should do the following (and you will test that your code can develop these results on two of the three AFM datasets provided and submit your results):

• Convert a raw AFM height dataset into an image

• Generate one random line on the image that allows at least 200 data points along its length

• Calculate the Mean and the Average Roughness for the chosen line

• Print all required plots to the screen in a single figure window (the histogram is not required to have "nice" bin edges, but it must have at least 30 bins to make a "smooth" curve)

• Print all user inputs, assumed values, and key results that required as part of the calculation.

• Display Plots 1, 2, and 3 (as appropriate based on the user input) to the screen in a single figure window using the subplot command

• Display to the screen the name of the AFM dataset being analyzed. Display all user inputs, assumed values, and key results that were required as part of the calculation.

Your team will also submit a copy of the output printed to the screen by creating two diaries: one for each of two (out of the three) sample AFM datasets (use the diary command in MATLAB). Please suppress printing of all computation lines before running your simulation so that the diary will not be too long. Otherwise, trim extraneous lines in the diary text file before printing the hard copy. Your output should clearly indicate which dataset is being analyzed.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download