• No results found

A13 Non-Linear Regression

N/A
N/A
Protected

Academic year: 2022

Share "A13 Non-Linear Regression"

Copied!
7
0
0

Loading.... (view fulltext now)

Full text

(1)

A13 ∙ Non-Linear Regression

Instructions

1. Read each problem carefully. You are responsible for following all instructions within each problem.

2. Review the grading flowchart for each problem in this assignment. These explain how your work will be graded.

3. Use the problem-specific m-file templates provided in the assignment file. Name your m-files to match the format in the table below, where login is your Purdue Career Account login.

Item Type Deliverables

Problem 1: Axis Scaling Individual  A13_axisScale_login.m Problem 2: Data Linearization Individual  A13_dataLin_login.m

Problem 3: General Models Individual  A13_genModels_login.m

Problem 4: Model Non-Linear Data Individual  A13_modelNonLin_login.m

Problem 5: Pharmaceutical Solubility Individual  A13_solubility_login.m

Gradescope Submission Individual  A13_login.pdf

4. Read the submission instructions on the last page of this assignment.

Notes Before You Begin this Assignment

Helpful MATLAB Commands

Learn about the following built-in MATLAB commands, which might be useful in your solutions:

polyfit, polyval, semilogx, semilogy, loglog

(2)

Problem 1: Axis Scaling

Deliverable

Script: A13_functionPredict_login.m

Problem

In this problem, you will practice using log scaling to display data and to use that display to predict what type of mathematical function would best represent the data (exponential, linear, logarithmic, or power). You have a data file named Data_functionPredictor.csv that contains 3 different x-y data sets. You must write a script that

• Creates 3 figures, one for each data set

• Each figure must contain a 2x2 subplot grid that follows these expectations:

Scale:

Linear X, Linear Y

Scale:

Logarithmic X, Linear Y Scale:

Linear X, Logarithmic Y

Scale:

Logarithmic X, Logarithmic Y

• Format each plot and figure for technical presentation, but use short, concise titles for each subplot axis.

In the ANALYSIS section, indicate which function type would best represent the data. Justify your selection.

Publish to PDF for Submission

Publish your script as PDF. You will merge the PDF with the other problems in this assignment.

(3)

Problem 2: Data Linearization

Deliverable

Script: A13_dataLin_login.m

Problem

In Problem 1, you plotted 3 different data sets on various log and linear scales to help identify function types.

For this problem, you will use the data from Data Set 1 and Data Set 3 from Problem 1. Using your knowledge of the function type for those two data sets, you must write a script to

• Import the data file and assign to variables the columns for Data Set 1 and Data Set 3 only;

• properly linearize the data for each data set;

• find the linear model for the linearized data for each data set;

• display the function type (exponential, linear, logarithmic, or power) and the linear model to the Command Window for each data set; and

• plot the linear model and the linearized data on the same axes, where the plot is professionally formatted, for each data set. Plot Data Set 1 on Figure 1 and Data Set 3 on Figure 2.

On your text and figure displays, be sure to include the name of the data set in the title of the display.

Publish to PDF for Submission

Publish your script as PDF. You will merge this PDF with the other problems in this assignment.

(4)

Problem 3: General Models

Deliverable

Script: A13_genModels_login.m

Problem

For this problem, you will practice converting linearized models to general models. You have access to two data sets and possible linearized models for each data set. To access this information, you will use the function A13_linCoef_Generator.p.

This is an encrypted MATLAB function, called “p-code”. P-code files do not have visible help lines, so the help lines are provided below. Read them to understand how to use the function.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Program Description

% This UDF uses a user's input to display Data Set 1 or Data Set 2 on 2x2 subplot

% grid, where the x and y data have been transformed using log base 10 as necessary

% {see axes labels) to aid in function identification. The UDF also displays 4 possible

% linearized models for the selected data.

%

% The UDF returns four sets of linearized coefficients for the selected data set, one for

% each of the four subplots/models displayed.

%

% Function call:

% coefsALL = A13_linCoef_Generator(type);

%

% Input Arguments

% 1. type = a number representing which data set to display

% Enter 1 to display Data Set 1

% Enter 2 to display Data Set 2

% Any input other than 1 or 2 will return an error.

%

% Output Arguments

% 1. coefsALL = a 4x2 array that contains the possible linearized coefficients

% Row 1: M, B for Plot A

% Row 2: M, B for Plot B

% Row 3: M, B for Plot C

% Row 4: M, B for Plot D

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

For each data set, you will run the p-code and visually inspect the results to determine which function type best represents the original data. Once you have selected the function type, you must write a script that does the following:

1. Runs the p-code for Data Set 1 to get the 4x2 array of possible linearized coefficients.

2. Selects the appropriate linearized coefficients based on your decision about function type, and uses those

(5)

Problem 4: Model Non-Linear Data

Deliverable

Script: A13_modelNonLin_login.m

Problem

You have been provided a data set in the file Data_problem4.csv. For this problem, you will practice using non-linear regression to find the model for the provided data set. You must write a script that follows the steps below.

1. Create one figure that contains four (4) subplots of the data in this configuration:

Scale:

Linear X, Linear Y

Scale:

Logarithmic X, Linear Y Scale:

Linear X, Logarithmic Y

Scale:

Logarithmic X, Logarithmic Y Format each subplot for technical presentation, but use short, concise titles for each subplot axis.

2. Run your script after step 1. Decide which function type is appropriate. Display the function type to the Command Window.

3. Do the data transformation to linearize the data based on the function type determined in Step 2.

4. Display the linearized model to the Command Window.

5. Create a second figure that plots the linearized data and model on the same axes. Format the plot for technical presentation.

6. Identify the function parameters for the function type determined in Step 2.

7. Display the final model with appropriate parameters and form to the Command Window.

8. Create a third figure that plots the original data and the final model on the same axes. Format the plot for technical presentation.

Publish to PDF for Submission

Publish your script as PDF. You will merge the PDF with the other problems in this assignment.

(6)

Problem 5: Pharmaceutical Solubility

Deliverable

Script: A13_solubility_login.m

Problem

Ingredient solubility is important to the development, testing, and manufacturing of pharmaceuticals. Many things can affect an ingredient’s solubility, such as its structure, the dissolving agent, time, or temperature. A pharmaceutical company has provided a data set from a solubility test for a new tablet they are testing. The file is named

Data_compoundPSF-034_90min_sol.csv. They measured the amount of active pharmaceutical ingredient that releases when a tablet is dissolved at varying temperatures. The time a tablet remained in the dissolving agent was held constant so that they could isolate the effect of temperature. You must model the relationship between temperature and solubility of the active ingredient.

You must write a program that uses the data set to create your model. Your program must do the following:

• Create Figure 1 that displays the original data in a 2x2 grid of subplots to show the data on various scaled axes.

o For this plot, use short titles for each subplot.

• Create Figure 2 that displays the linearized model and linearized data on one set of axes.

• Create Figure 3 that displays the general model and original data on one set of axes.

• Display the general model’s function type, the linearized model with coefficients, and the general model with coefficients to the Command Window.

Use professional formatting to display the figures and text, including meaningful variable names in place of ‘x’ and ‘y’.

In the ANALYSIS section, answer the following questions.

Q1. Justify your model selection using your knowledge of the data.

Q2. Use your model to predict the solubility at 0 deg C, 37 deg C, and 100 deg C.

Publish to PDF for Submission

Publish your script as PDF. You will merge this PDF with the other problems in this assignment.

(7)

How to Submit Your Work

After you complete the assignment and are ready to submit your work,

1. Merge all the problem PDFs into a single PDF file. Name that file A13_login.pdf.

2. Log into Gradescope and submit A13_login.pdf to the A13 assignment. Indicate which pages correspond each problem.

Failure to tag the problems appropriately will result in your work losing credit for all wrongly tagged problems.

3. Log into Blackboard and submit all deliverable files to the A13 Dropbox.

 A13_axisScale_login.m

 A13_dataLin_login.m

 A13_genModels_login.m

 A13_modelNonLin_login.m

 A13_solubility _login.m

 A13_login.pdf

Failure to submit these files to Blackboard may result in 0 for the assignment.

Refer to the activity in A00 in Class 2 if you need help publishing, merging PDFs, or submitting to Gradescope or Blackboard.

References

Related documents

ZBDB uses columnar storage and massively parallel processing on a Graphics Processor to handle all of your data. ZBDB seamlessly distributes your data and queries over thousands

● From the Start/Finish at the River House Barn, head south and cross Fig Ave into the River Campground and head EAST and connect with Main Loop trail.. ● The main loop trail will

> Direct Deposit Transfer Letter > Automatic Payment Transfer Letter > Account Closure Request Letter... We’re dedicated to ensuring that your transition is a

BRAILLE GravoTac Gravoglas 2 (matte) PLASTIC Gravoply 1 Metallex Gravoply Ultra Gravoply 2 Gravoply 3C Gravoglas 2 GravoTac Gravostrat Gravoply Laser Gravoglas 1 METAL

DataCite is an international consortium founded in 2009 by organisations from six countries, including the United Kingdom, to establish a robust citation format for data used

However, image of a space object could be taken at any point in the sphere centered at the object, and the appearance of the same satellite changes greatly in images taken

Reconnex Niche player Network filtering – CMF to capture full forensic information of inbound and outbound traffic in a database. Integrate with e-mail systems and

Cool and green roofs led to small changes in sur- face air temperature, mean radiant temperature, and consequently thermal comfort, due to the fact that these strategies modify