In: Computer Science
Please solve the following problem for MATLAB
Write a user-defined function (name it F to C) that converts temperature in degrees F to temperature in degrees C. Use the function to solve the following problem. The change in the length of an object, ∆L, due to a change in the temperature, ∆T, is given by: ∆L = αL∆T, where a is the coefficient of thermal expansion. Determine the change in the area of a rectangular(4.5 m by 2.25m) aluminum (α=23·10-61/˚C) plate if the temperature changes from 40 ˚F to 92 ˚F.
Code to copy along with screenshots of code and output are provided.
Please make sure to save the code in matlab script
file before executing,
If you have any doubts or issues. Feel free to ask in
comments
Please give this answer a like, or upvote. This will be very
helpful for me.
================================================================
Screenshots of Code :
Screenshots of Output :
Code to copy:
%to clear the output screen
clc;
% initial temperature as given in question
initial_temp = 40;
% final temperature as given in question
final_temp = 92;
% initial area of rectangular aluminium plate as given in
question
initial_Area = 4.5*2.25;
% converting initial T to Celcius using our F_to_C()
function
initial_temp_in_C = F_to_C(initial_temp);
% converting final T to Celcius using our F_to_C()
function
final_temp_in_C = F_to_C(final_temp);
% calculating the difference in temperatures
change_in_temp = final_temp_in_C - initial_temp_in_C;
% calculating coefficient of thermal expansion
a_coeff = 23 * (10^(-6));
% caculating change in area with the formula :
% change_in_area = 2*a*A*dT
% where a = coefficient of thermal expansion
% A = initial Area
% dT = difference in temperature
change_in_area = 2 * a_coeff * initial_Area * change_in_temp;
% diplaying result
disp("Change in area = "+ change_in_area );
% function to convert Fahrenheit to Celcius
function cel = F_to_C(fahr)
cel = (5/9)*(fahr-32);
end
==============================