Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write your own functions to solve the following problems: 1. Produce a conversio

ID: 2998221 • Letter: W

Question

Write your own functions to solve the following problems: 1. Produce a conversion table for Celsius and Fahrenheit temperatures. The input to the function should be two numbers: Tlower and Tupper which define the lower and upper range, in Celsius, for the table. The output of the function should be a two column matrix with the first column showing the temperature in Celsius, from Tlower and Tupper with an increment of 1 degree C, and the second column showing the corresponding temperature in Fahrenheit.

Explanation / Answer

Save the function below as conversion.m

function [T] = conversion(Tlower,Tupper)
T(:,1) = Tlower:1:Tupper;
T(:,2) = T(:,1)*1.8+32;

Run the function in command windows. One example is shown below

>> [T]=conversion(20,30)
T =
   20.0000   68.0000
   21.0000   69.8000
   22.0000   71.6000
   23.0000   73.4000
   24.0000   75.2000
   25.0000   77.0000
   26.0000   78.8000
   27.0000   80.6000
   28.0000   82.4000
   29.0000   84.2000
   30.0000   86.0000