Please perform the following code using matlab: Consider the following informati
ID: 3818739 • Letter: P
Question
Please perform the following code using matlab: Consider the following information about metals: a) Create the following arrays: Store the name of all metals into a cell array. Store the symbol for all these metals into a cell array. Store the atomic number into an int 8 integer array. Store the atomic weight into a numeric array. Store the density into a numeric array. Store the crystal structure into a single padded character array. b) Group the arrays you created in part (a) into a single cell array, named dataCellArray. c) Extract the following information from your cell array (i.e., form dataCellArray): Find the name, atomic weight, and crystal structure of the fourth element in dataCellArray. Find the average atomic weight off all the elements in dataCellArray. Answer for a: metalNames = {'Aluminium', 'Copper1, 'Iron', 'Molybdenum', 'Cobolt', 'Vanadium'};% Storing metal names in a cell array symbols = {'Ar', 'Cu', 'Fe', 'Mo', 'Co', ' V'}; % Storing metal Symbols in a cell array atomicNumbers = int8([13, 29, 26, 42, 27, 23]); % storing metal Symbols in an int8 array atomicWeight = [26.98, 63.55, 55.85, 95.94, 58.93, 50.94]; % Storing atomic weights in an integer array density = [2.71, 8.94, 7.87, 10.22, 8.9, 6.0]; % Storing density in an integer array % storing Crystal Structure in single padded char array crystalStructure = char(['FCC', 'FCC', 'BCC', 'BCC', 'HCP', 'BCC']); Answer for b: % Combining all the above in one cell array called dataCellArray dataCcllArray = {metalNames, symbols, atomicNumbers, atomicWeight, density, crystalStructure}; Answer for c: % Finding 4rth element weight and crystalStructure FourthElement = {dataCellArray{1, 1} {1, 4}, fourthElementWieght = dataCellArray {1, 4} (l, 4), fourthElementCrystalStructure = dataCellArray{l, 6}(7:9)} Average = mean(dataCell Array {1, 4})% Mean of all atomicWeights in dataCellArray Store the information presented in Problem 4 into a structure array. Name your structure array dataStructArray. Use your structure array to determine a) the maximum density. b) the clement with the maximum density. c) the element with the maximum atomic weight.Explanation / Answer
Answer for a:
metalNames = {'Aluminium','Copper','Iron','Molybdenum','Cobolt','Vanadium'};% Storing metal names in a cell array
symbols = {'Al','Cu','Fe','Mo','Co','V'}; % Storing metal Symbols in a cell array
atomicNumbers=int8([13,29,26,42,27,23]); % storing metal Symbols in an int8 array
atomicWeight=[26.98,63.55,55.85,95.94,58.93,50.94]; % Storing atomic weights in an integer array
density=[2.71,8.94,7.87,10.22,8.9,6.0]; % Storing density in an integer array
% storing Crystal Structure in single padded char array
crystalStructure=char(['FCC','FCC','BCC','BCC','HCP','BCC']);
Answer for b:
% Combining all the above in one cell array called dataCellArray
dataCellArray={metalNames,symbols,atomicNumbers,atomicWeight,density,crystalStructure};
Answer for c:
% Finding 4rth element weight and crystalStructure
FourthElement={dataCellArray{1,1}{1,4},fourthElementWieght=dataCellArray{1,4}(1,4),fourthElementCrystalStructure=dataCellArray{1,6}(7:9)}
Average= mean(dataCellArray{1,4})% Mean of all atomicWeights in dataCellArray
Please Thumbs up if it helped you !! Thanks
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.