Question

In: Computer Science

Please solve the following problem for MATLAB Write a user-defined function (name it F to C)...

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.

Solutions

Expert Solution

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



==============================


Related Solutions

Please solve the following problem for MATLAB Write a user-defined function that calculates the average and...
Please solve the following problem for MATLAB Write a user-defined function that calculates the average and the standard deviation of a list of numbers. Use the function to calculate the average and the standard deviation of the following list of grades : 80 75 91 60 79 89 65 80 95 50 81
Write a user-defined MATLAB function that converts real numbers in decimal form to binary form. Name...
Write a user-defined MATLAB function that converts real numbers in decimal form to binary form. Name the function b = deciTObina (d), where the input argument d is the number to be converted and the output argument b is a 30-element-long vector with 1s and 0s that represents the number in binary form. The first 15 elements of b store the digits to the left of the decimal point, and the last 15 elements of b store the digits to...
Write a user-defined MATLAB function that uses classical fourth order Runge-Kutta method to solve a first...
Write a user-defined MATLAB function that uses classical fourth order Runge-Kutta method to solve a first order ODE problem dydx = f(x, y) in a given interval a ? x ? b with initial condition y(a) = y0 and step size of h. For function name and arguments, use [x,y] = myrk4(f, a, b, h, y0) Check your function to find the numerical solution for dydx=?1.2y+7e^(?0.3x) in the interval 0 ? x ? 4 with initial condition y(0)=3. Run your...
MATLAB Write a user defined function for a projectile motion. If a ball is launched from...
MATLAB Write a user defined function for a projectile motion. If a ball is launched from initial position(0,0) with a velocity v0 at angle θ, determine your horizontal and vertical position. Please plot x vs. t, y vs. t and y vs. x.
Write a user-defined MATLAB function, with two input and two output arguments that determines the height...
Write a user-defined MATLAB function, with two input and two output arguments that determines the height in centimeters (cm) and mass in kilograms (kg)of a person from his height in inches (in.) and weight in pounds (lb). (a) Determine in SI units the height and mass of a 5 ft.15 in. person who weight 180 lb. (b) Determine your own height and weight in SI units.
Write a user defined MATLAB program that performs power factor correction. The inputs to the MATLAB...
Write a user defined MATLAB program that performs power factor correction. The inputs to the MATLAB function should be voltage across the load (in Vrms, assume 0 phase), frequency Resistance of the load Inductance of the load power factor of the load target power factor The output of the function should be the size of the capacitor that one would need to place in parallel with the load to reach the target power factor. Please submit the code for the...
Consider the user-defined MATLAB function below, ht_mp_ch(). The function ht_mp_ch(), outputs the sampled version of the...
Consider the user-defined MATLAB function below, ht_mp_ch(). The function ht_mp_ch(), outputs the sampled version of the impulse response hmp(t) of the multipath fading channel as a vector. function impulse_response=ht_mp_ch(max_delay,L,decay_base,t_step) t_vector=0:t_step:max_delay; mp_tmp=0*(t_vector); path_delays=[0 sort(rand(1,L-1)*max_delay)]; impulse_positions=floor(path_delays/t_step); mp_tmp(impulse_positions+1)=exp(j*2*pi*rand(1,L)); mp_tmp=mp_tmp.*(decay_base.^(t_vector/max_delay)); impulse_response=mp_tmp/sqrt(sum(abs(mp_tmp).^2)); Explain what the variable on the left-hand side represents and justify how the right-hand side expression is formulated by adding comments to every line.
Using Python C++ Purpose: Write and test a non-trivial 2-d array function. Write a user-defined function...
Using Python C++ Purpose: Write and test a non-trivial 2-d array function. Write a user-defined function that, given an arbitrary 2-d array as input, returns its perimeter sum, which is defined as the sum of all the elements along its perimeter. You must name your function perimeter_sum
Write a user defined function named “findTwosComplement” in C++, which will find 2’s complement of a...
Write a user defined function named “findTwosComplement” in C++, which will find 2’s complement of a signed number. Input must be passed by reference to the function and it will return the answer. There is no need to call this function anywhere. You can use following operators only: <<>> ~ & ^ | Decimal
(Using Matlab) and "while" function 1.   Write a program that prompts the User for if they...
(Using Matlab) and "while" function 1.   Write a program that prompts the User for if they would like to enter a real number. If yes, prompt the User for the real number. Continue to do this until the User enters “no” to the first question. After the User enters “no”, display the average of all the numbers entered. (Using Matlab) and "while" function 2.   Write a program that prompts the User for if they would like to enter a real...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT