Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MATLAB ONLY!!!!!!!!!!!!!!!!!!!!!!!! Objective: Write a program that read periodi

ID: 3569168 • Letter: M

Question

MATLAB ONLY!!!!!!!!!!!!!!!!!!!!!!!!

Objective:

            Write a program that read periodic table for metals and perform required functions

Detailed Description:

The table below contains information collected from a set of metals. The first column consists of metal names and the remaining columns correspond to other information.

Periodic Table

Metal

Symbol

Atomic Number

Atomic Weight

Density g/cm^3

Crystal Structure

Aluminum

Al

13

26.98

2.71

FCC

Copper

Cu

29

63.55

8.94

FCC

Iron

Fe

26

55.85

7.87

BCC

Molybdenum

Mo

42

95.94

10.22

BCC

Cobalt

Co

27

58.93

8.9

HCP

Vanadium

V

23

50.94

6

BCC

Beryllium

Be

4

9.0122

1.85

HCP

Titanium

Ti

22

47.867

4.51

HCP

Calcium

Ca

20

47.867

1.54

FCC

Europium

Eu

63

151.964

5.24

BCC

Required functions:

1)A function that can calculate average atomic weights for all metal elements

2)A function that can count elements having density greater than 2 g/cm^3

3) A function that can count elements having Centered Cubic structure. The Centered Cubic structure includes Face Center Cubic (FCC) and Base Center Cubic (BCC).

Notes:

You can use either cell arrays or structure arrays to implement required functions.

Results:

1)Average atomic weights for all metal elements

2)Number of elements having density greater than 2 g/cm^3

3)Number of elements having Centered Cubic structures

MATLAB ONLY!!!!!!!!!!!!

Metal

Symbol

Atomic Number

Atomic Weight

Density g/cm^3

Crystal Structure

Aluminum

Al

13

26.98

2.71

FCC

Copper

Cu

29

63.55

8.94

FCC

Iron

Fe

26

55.85

7.87

BCC

Molybdenum

Mo

42

95.94

10.22

BCC

Cobalt

Co

27

58.93

8.9

HCP

Vanadium

V

23

50.94

6

BCC

Beryllium

Be

4

9.0122

1.85

HCP

Titanium

Ti

22

47.867

4.51

HCP

Calcium

Ca

20

47.867

1.54

FCC

Europium

Eu

63

151.964

5.24

BCC

Explanation / Answer

main file

file_name='Periodic_table.csv';
data=dataset('File',file_name,'Delimiter',',');
mass=data.AtomicWeight;
Average_mass(mass);
density=data.DensityG_cm_3;
count(density);
str=data.CrystalStructure;
Center(str);

1)

function []=Average_mass(masses)
temp=sum(masses);
[m,n]=size(masses);
temp=temp/m;
fprintf('Average Atomic weight = %f ',temp);
end

2)

function []=count(densities)
x=densities>2;
fprintf('Elements have density greater than 2g/cm^3 are = %d ',sum(x));
end

3)

function [] = Center(arr)
where1 = strcmp('FCC', arr) == 1;
where2=strcmp('BCC', arr) == 1;
where =sum(where1)+sum(where2);
fprintf('Elemsnts having Centeres Cubic Structure = %d ',sum(where))
end

Periodic_table.csv file

Metal Symbol Atomic Number Atomic Weight Density g/cm^3 Crystal Structure Aluminum Al 13 26.98 2.71 FCC Copper Cu 29 63.55 8.94 FCC Iron Fe 26 55.85 7.87 BCC Molybdenum Mo 42 95.94 10.22 BCC Cobalt Co 27 58.93 8.9 HCP Vanadium V 23 50.94 6 BCC Beryllium Be 4 9.012 1.85 HCP Titanium Ti 22 47.87 4.51 HCP Calcium Ca 20 47.87 1.54 FCC Europium Eu 63 152 5.24 BCC