Write a script to create a matrix of temperature in degree C degree K for every
ID: 3790984 • Letter: W
Question
Write a script to create a matrix of temperature in degree C degree K for every multiple of 15 from 0-100 degree C. Combine the four results into one matrix and dis T_c = 5/9 (T_f - 32 degree) T_F = 9/5 (T_c + 32 degree) T_K = T_c + 273.15 degree T_R = T_f = 459 7 degree Output degree C degree F degree R degree K 0 32.0000 491.6900 273.1500 15.0000 59.0000 518.6900 288.1500 30.0000 86.0000 545.6900 303. 1500 45.0000 113.0000 572.6900 318.1500 60.0000 140.0000 599.6900 333.1500 75.0000 167.0000 626.6900 348.1500 90.0000 194.0000 653.6900 363.1500Explanation / Answer
% matlab script
M = zeros(7,4);
celsius = 0.0;
i = 1;
j = 1;
while celsius <= 100
% determine fahrenheit
f = (9/5)*(celsius) + 32;
% determine r
r = f + 459.7;
% determine kelvin
k = celsius + 273.15;
% put celsius in matrix
M(i,j) = celsius;
% go to next position
j = j + 1;
% put fahrenheit in matrix
M(i,j) = f;
% go to next position in row
j = j + 1;
M(i,j) = r;
j = j + 1;
% put kelvin in matrix
M(i,j) = k;
% increment clesius and go to next row
celsius = celsius + 15.0;
i = i + 1;
j = 1;
end
disp(" C F R K ");
disp(M);
%{
output:
C F R K
0.00000 32.00000 491.70000 273.15000
15.00000 59.00000 518.70000 288.15000
30.00000 86.00000 545.70000 303.15000
45.00000 113.00000 572.70000 318.15000
60.00000 140.00000 599.70000 333.15000
75.00000 167.00000 626.70000 348.15000
90.00000 194.00000 653.70000 363.15000
%}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.