首页 > > 详细

辅导 PHYS5033 More MATLAB & Wrap up辅导 Matlab语言

PHYS5033

Useful MATLAB commands

>> a = b * c;   % matrix multiplication

>> d = a’;   % matrix transposition

>> col_sum = sum(a,1);   % column summation operator

>> row_sum = sum(a,2);   % row summation operator

>> load(‘T.mat’);   % bring a saved matrix into the workspace

>> y = readmatrix(‘my_exp.csv’);   % read a matrix into the workspace

Using scripts to run multiple commands

• Create a new folder on your computer

• Give it a name, for example “PHYS5033_MATLAB”

• Download and unzip the data files from Week 12 or 13 “Lecture Resources”

• Open MATLAB

• Navigate to the folder into which you have saved the data file

• Type the following in the command window:

>> edit PHYS5033_practice

Putting knowledge into practice

Sustainability Assessment of an economy

Follow the steps below to calculate the total carbon footprint of an economy in MATLAB.

1. Load the files T, v, y and Q in the workspace.

2. Calculate the total input and total output of the economy.

3. Test if your input-output system is balanced.

4. Calculate the direct intensity q

5. Calculate the A matrix and the Leontief inverse L.

6. Calculate the total intensity m

7. Calculate the total footprint by sector.

8. Calculate the total footprint of the economy.

HINT: eye (for making identity matrices); inv (for taking an inverse)

Putting knowledge into practice

Sustainability Assessment of an individual’s expenditure

Step 1 - Create an expenditure vector

Tips:

• Focus on the direct expenditure, not any potential upstream or downstream expenditure. The L matrix takes care of that for us.

• Rent is usually paid to a real estate agent, but may be to the University if you are in Student Accommodation

• Purchasing second-hand items may mean that your expenditure is directed at community groups

• Beware of allocating all expenditure to the Retail sector

Follow the steps below to calculate the carbon footprint of an individual in MATLAB.

1. Load the files ‘IntermediateDemand.mat’, ‘Output.mat’, and ‘Satellite.mat’ in the workspace

2. Read in the .csv file with the individual’s expenditure (1 column of numbers only)

3. Calculate the direct intensity q

4. Calculate the A matrix and the Leontief inverse L

5. Calculate the total intensity m

6. Calculate the individual’s total footprint

7. Calculate the individual’s footprint by sector

HINT: eye (for making identity matrices); inv (for taking an inverse)





联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!