Question: Please solve using Matlab as a function One form of an equation to estimate a components heat capacity is: Cp = a + b[ +
One form of an equation to estimate a components heat capacity is: Cp = a + b[ + cT-2 Using a switch structure write a main program m file in MATLAB which will call a user function named heatcap to calculate the heat capacity of any compound having the above form in which the coefficients a, b & c along with the temperature in Kelvin are passed to the function and the heat capacity is returned. The user should be prompted to enter a 1 or a 2 to select the type of loop used for the problem. When case 1 is selected a for loop should execute and when case 2 is selected a while loop should run to find the heat capacity for both Magnesium Oxide and Ferric Oxide for temperatures ranging from 300K to 900K in 50 degree increments. A header should be put outside the loop and then each time through the loop the values of heat capacity should be printed as shown below. Temperature(K) (Kelvin) 300 350 Cp-Mgo (J/mol-K) XX.X XX.X Cp-Fe203 (J/mol-K) XX.X XX.X The program should also store the values of the heat capacity and temperature for both components into an array and then plot the heat capacity as a function of temperature on a single plot, which is labeled appropriately
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
