ME 224 Numerical Methods for Engineers Assignment 6 The spec

ME 224 -Numerical Methods for Engineers Assignment 6 The specific heat at constant volume for a liquid can often be modeled by the following curve fit equation: where a, are a are material constants and T is the temperature in Kelvins [K. If the liquid is carbon dioxide, the constants are: -8726.361 a-184.004 as-1.914025 4-1.667825 x 103 as = 7.30595 x 10\" as1.25529 x 10-1 If the liquid is octane, the constants are: a40859.678 a2--322.50398 6.6958265 a4 =-2.6759063 x 10-3 as- 0.0 Your job is to create a MATLAB function file named \"evcon_\'yourinitials\". The inputs should be: 1· The material 2. The temperature (could be a scalar or vector) The output should be the specific heat (could be a scalar or vector depending on the temperature input). Below are four test cases that you should run. ature -20 Carbon Dioxide Carbon Dioxide Carbon Dioxide Carbon Dioxide Octane Octane Octane Octane -15 0. 80 -10 25 100

Solution

clc
clear all
acarb=[8726.361;-184.004;1.914025;-1.667825*1e-3;7.30595*1e-7;-1.25529*1e-10];
aoct=[40859.678;-322.50398;6.6958265;-2.6759063*1e-3;0;0];
material=input(\'Enter material type\ \',\'s\');
T=input(\'Enter temperature values\ \');
if material==\'carbon\'
a=acarb;
cv=(a(1)./T)+a(2)+(a(3).*T)+(a(4).*T.^2)+(a(5).*T.^3)+(a(6).*T.^4);
elseif material==\'octane\'
a=acoct;
cv=(a(1)./T)+a(2)+(a(3).*T)+(a(4).*T.^2)+(a(5).*T.^3)+(a(6).*T.^4);
else
disp(\'invalid input\')
end
cv

RESULT:

Enter material type
carbon
Enter temperature values
[-20 -15 0 80]

cv =

-659.2755 -794.8495 Inf 67.8924

Enter material type
octane
Enter temperature values
[-10 0 25 100]

cv =

1.0e+003 *

-4.4757 Inf 1.4776 0.7289

 ME 224 -Numerical Methods for Engineers Assignment 6 The specific heat at constant volume for a liquid can often be modeled by the following curve fit equation

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site