Hi, I need help with this MATLAB question please. Ineed the answer ASAP. Note: T
ID: 3797923 • Letter: H
Question
Hi, I need help with this MATLAB question please. Ineed the answer ASAP. Note: This assignment is part of mt BE1500 Class: Into to Programming & Computer Engineering. This is an intro level.
Create your own function to perform a temperature conversion between Celsius and Fahrenheit. The function input should be two values of a temperature range: a lower temperature (Tlow) and an upper temperature (Tupp). The function body should use the inputs to create a vector of Celsius temperatures with an increment of one degree Celsius, then calculate the corresponding Farenheit temperatures. The output of the function should be a two column matrix with the first column showing the temperature in Celsius, with rows displaying temperatures from Tlow and Tupp, and the second column showing the corresponding temperature in Fahrenheit. (Submit one function file; be sure to copy and paste command line code that demonstrates results from function calls and testing)
Explanation / Answer
function x = fun(Tlow, Tupp)
x = rand(2,Tupp-Tlow+1);
x(1, :) = Tlow:1:Tupp;
size(x)
x(2, :) = arrayfun(@toFerhn, x(1,:));
x = x';
end
function f = toFerhn(c)
f = (c*1.8) +32;
end
OUTPUT:
fun (-3,3)
-3.00000 26.60000
-2.00000 28.40000
-1.00000 30.20000
0.00000 32.00000
1.00000 33.80000
2.00000 35.60000
3.00000 37.40000
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.