Scatterplot of data with intensity of light transmission

Assignment Help MATLAB Programming
Reference no: EM131332488

QUESTION 1

Background

Climate change is a change in global or regional climate patterns, in particular a change apparent from the mid to late 20th century onwards and attributed largely to the increased levels of atmospheric carbon dioxide produced by the use of fossil fuels. The CO2 emissions (kt) from nine countries since year 1990 have been given in the text file ‘CO2_Emission.csv'. Each of the nine countries have been annotated with a country ID as given below:

Country ID

Country

1

Argentina

2

Australia

3

Belgium

4

China

5

Denmark

6

France

7

Malaysia

8

United Kingdom

9

United States

Q1a

Write Matlab scripts in a M-file (Assn_Q1.m) that will read data from ‘CO2_Emission.csv' (skip the text lines) and store the data in a matrix called ‘emission'. You shall not use import wizard to load the data from the text file.

Output the size of the matrix ‘emission' to the command window.

Then using the command ‘fprintf', to print out the data read from the text file following the format as follows:

CO2 emission (kt) by year

Country

1990

2000

2007

2008

2009

2010

2011

2012

2013

Argentina

112613.6

142136.6

175176.3

189107.2

179961.7

187919.1

191633.8

192359.8

189818.6

Australia

263705

329443.3

372090.5

385904.1

394792.9

372798.2

376710.9

375456.8

377906.4

Belgium

106049.6

115118.1

103545.1

104443.5

100259.4

107751.1

98917.33

92195.71

93618.51

China

2460744

3405180

6791805

7175659

7618684

8767878

9724591

10020745

10249463

Denmark

50230.57

51330.67

50256.24

46933.93

44510.05

46640.57

40645.03

36405.98

38067.13

France

375632.8

362090.6

368914.9

366069.3

351632.3

352769.1

331537.1

332956.3

333191

Malaysia

56592.81

125734.1

184816.8

204031.9

198802.7

218476.2

220405

218707.2

236510.5

United Kingdom

555924.5

541784.6

528425.7

520072.3

471400.2

493607.5

447935.1

467197.8

457472.9

United States

4823557

5701829

5794923

5622464

5274129

5408869

5305280

5115806

5186168

Q1b

Based on the data read from "CO2_Emission.csv", write Matlab scripts in the same M-file (written in Q1a) to:

i. Compute average CO2 emission for each of the nine countries.
ii. Compute average CO2 emission for each year
iii. Find out the country with highest average CO2 emission.
iv. Find out the year with highest average CO2 emission.
v. Find out how many countries with their CO2 emission higher than the average emission in year 2010

Use fprintf command to display your output.

Q1c

In the same M-file, write Matlab script to figure out the country with highest hike and largest decrement in the CO2 emission between year 1990 and 2013 respectively.

Use plot command to create a red line chart to show only the trend of CO2 emission for the country with highest hike between year 1990 and 2013.

In the same figure, plot another blue line chart to show only the trend of CO2 emission for the country with largest decrement between year 1990 and 2013.

Note:
You have to create two separate plots which are juxtaposed in a same figure for the task mentioned above. (Hint: Use subplot)

You need to include relevant title, x-axis & y-axis labels and the identified country name in the legend of the plots.

QUESTION 2

Background

Visible light is the reason we can see anything at all. Light moves as a wave, bouncing off objects so we are able to see them. Transmission of light is a phenomenon when light waves move all the way through a material without being absorbed. When light moves through a transparent (or semi-transparent) material, it can be transmitted, absorbed or reflected.

Experiments measuring the intensity of light transmitted through specimens of a transparent solid of various lengths are given in a text file (LightTransmit.txt).

Note: When attempting the each of the following tasks, ensure all units in your data are consistent, i.e S.I units. You cannot mix units.

Q2a
Write Matlab scripts in a M-file (Assn_Q2.m) that will read data from ‘LightTransmit.txt' (skip the text lines). Unfortunately, there are a few ‘noises' in the dataset (those data with It value higher than 10) and your Matlab program should skip those data as well and store the rest of the data in a matrix called ‘transmission_data'. You shall not use import wizard to load the data from the text file.

Then, use scatter command to create a scatterplot of data with intensity of light transmission, It, versus length of the transparent solid, L. You need to include appropriate title, legend and label of x-axis and y-axis in your plot.

Q2b

Based on the data distribution pattern observed in your scatter plot from Q2a, you predict the relationship between the intensity of light transmission and the transparent solid length could possibly be related by a polynomial equation. Perform a polynomial fit with a third order polynomial and make a plot for the polynomial equation which is overlaid with the scatter plot from Q2a. You should also create 50 interpolated data points onto your plot which are shown as red dots.

Hint: You may need to use the Matlab built-in functions polyfit and polyval for this task.

By observing the plot you made for the task above, your polynomial model seemingly fit the existing data points well. Try to create an extrapolated plot by extending the L upper limit to 0.1 m. Place your extrapolated plot in juxtaposition with your previous plot in this task Q2b (use subplot command). What could you observe and conclude from your extrapolated plot? Use fprintf command to show your brief description of your observation and conclusion (e.g. what's the problem you can find on the current polynomial model to relate the light transmission with the length of the transparent solid ? ) on command window.

Q2c

After having literature review, you find that the transmission of light through a transparent solid can be described by a theoretical equation:

IT = I0(1-R)2e-βL

IT = Intensity of light transmission I0 = Intensity of the incident beam
R = fraction of light which is reflected at the interface
β = absorption coefficient
L = the length of the transparent solid

Given that the intensity of the incident beam, I0 is 5 watts/m2. Use the data stored in matrix ‘transmission_data' which is done in Q1a to determine the absorption coefficient, β and fraction of light, R through curve fitting.

You shall not use Matlab built-in function for curve fitting such as polyfit, fit etc for this task. You have to write a user-defined regression function to obtain the absortion coefficient β and the fraction of light, R. The inputs to the function are two vectors (L and It in this context). The user-defined function must ensure the inputs of the vectors are of same length. If the two input vectors are not equal, it shall display an error message and terminate the program. The output arguments of this function are the coefficients a1 and a0 of a linear equation.

Hint: You may consider to adopt least-square linear regression to a non-linear model

Q2d

After performing curve fitting, make a line chart for the equation based on the β and R values you obtained from Q2c. Overlaid your line chart on a new scatter plot created based on the same dataset used in Q2a. The plot you create for this task shall be placed below the plot created in Q2b (use subplot).

Calculate the coefficient of determination and add it at the top of the plot as a text label using the Matlab command ‘text'.

Try to create another extrapolated plot for your current curve fitted model by extending the L upper limit to 0.1 m. Place your extrapolated plot in juxtaposition with your plot created in this task Q2d (use subplot command).

Q2e

Based on the equation given in question Q2c, use modified secant method to find an approximation of L when It is 3.3 watts/m2. You have to create another user-defined function (in separate function file) that use the modified secant method to find the root. Your user-defined function f shall include input arguments of a function handle, an initial guess, a small perturbation fraction and precision value. Test the user-defined function by prompting the user for an initial guess. You could presume the precision value is predefined as 0.001% and the perturbation fraction is 0.001. The function shall return the value of root. Display the root (which is the approximation of L) on command window with four decimal places.

Attachment:- LightTransmit - CO2_Emission.rar

Reference no: EM131332488

Matlab has a built-in ability to perform mathematical

MATLAB has a built-in ability to perform mathematical operations on complex numbers. However, there are times when it is useful to treat complex numbers as a structure. Writ

What is the period of the forced oscillation

MAT 275 Forced Equations and Resonance - What is the period of the forced oscillation? What is the numerical value (modulo 2Π) of the angle α defined by and Determine analyt

Estimate the area of the tea spill

The surface area of a tea spill is estimated by measuring the width (in cm) of the spill at equally spaced intervals of 1.5 cm (width data is found in TeaSpill.txt). Use num

Division by zero is not possible

You must also ensure that division by zero is not possible. If the user tries to divide by zero, the calculation should not be attempted, and an error message should appear

Write a script that simulates a casino machine

Write a script that simulates a casino machine. To play a single round on the machine user pays $ 5. Now when the user start the machine, the machine rolls a pair of dice (s

Plot the angular velocity of the pendulum

Plot the angle of the pendulum as calculated from all three ODE solver methods on a single plot, ensuring that the plot is titled, all axes are labelled, units are indicated

How is the actual choice of policy determined

How is the actual choice of policy determined by individual preferences? The median voter theorem, according to which the tax rate selected by the government is the one pref

Find the average value and the power of signal

Find the average value and the power of this signal by integrating 1/T0 v(t) and 1/T0 v2(t) respectively in the time domain, over one period. Your answer must be expressed in

Reviews

len1332488

12/29/2016 1:22:00 AM

ASSIGNMENT HELP 1) You can ask questions in the Discussion Board on Moodle 2) Hints and additional instructions are provided as comments in the assignment template M---Files 3) Hints may also be provided during lectures 4) The questions have been split into sub---questions. It is important to understand how each sub--- question contributes to the whole, but each sub---question is effectively a stand---alone task that does part of the problem. Each can be tackled individually. 5) I recommend you break down each sub---question into smaller parts too, and figure out what needs to be done step---by---step. Then you can begin to put things together again to complete the whole.

len1332488

12/29/2016 1:21:46 AM

Your assignment will be marked in your usual computer lab session during Week 12. YOU MUST BE IN ATTENDANCE TO HAVE IT MARKED. It is your responsibility to ensure that everything needed to run your solution is included in your ZIP file (including data files). It is also your responsibility to ensure that everything runs seamlessly on the (Windows---based) lab computers (especially if you have used MATLAB on a Mac OS or Linux system).This assignment is worth 10% (1 Mark == 1%). Code will be graded using the following criteria: 1) Your code produces correct results (printed values, plots, etc…) and is well written.

len1332488

12/29/2016 1:20:45 AM

This assignment should be completed INDIVIDUALLY. If a part of your code is written in collaboration with classmates, say so in your comments and clearly state the contributions of each person. Submit your assignment online using Moodle. You must include the following attachments: 1) A ZIP file (NOT .rar or any other format) named after your student ID containing the following: a. Solution M---Files for assignment tasks b. Any additional function files required by your M---Files c. All data files needed to run the code, including the input data provided to you Follow “ENG1060 Assignment ZIP file instructions.pdf” to prepare your zip file for submission. 2) An assignment cover sheet with your name and ID (do NOT include this in the zip file)

Write a Review

 
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd