I am not looking for someone to just straight up answer the question for me, as
ID: 3864621 • Letter: I
Question
I am not looking for someone to just straight up answer the question for me, as I have most of the code written the way I know it is meant to be. I am just confused with formatting the data to print at the bottom of the table correctly. below is the code I have written already
clc, clear all
min = input('Enter the minmum kW:') %kw
max = input('Enter the maximum kw:') %kw
kiloWatt = [ ]; %kW
for r = 1:4
for c = 1:3
kiloWatt(r,c) = min + rand(1) * (max - min);
end
end
btu = kiloWatt * 3412.14; %Btu/h
hp = btu ./ 2544.5; %hp
footLbs = kiloWatt * 737.56; % ft lbf/s
fprintf(' Power Conversion Table ')
fprintf(' kW Btu/hr hP LbsF')
Explanation / Answer
clc, clear all
min = input('Enter the minmum kW:') %kw
max = input('Enter the maximum kw:') %kw
kiloWatt = [ ]; %kW
for r = 1:4
for c = 1:3
kiloWatt(r,c) = min + rand(1) * (max - min);
end
end
btu = kiloWatt * 3412.14; %Btu/h
hp = btu ./ 2544.5; %hp
footLbs = kiloWatt * 737.56; % ft lbf/s
%converting each 4 by 3 matrix to 12 by 1 matrix i.e a column vector
btu=reshape(btu,12,1);
hp=reshape(hp,12,1);
footLbs=reshape(footLbs,12,1);
kiloWatt=reshape(kiloWatt,12,1);
fprintf(' Power Conversion Table ')
fprintf(' kW Btu/hr hP LbsF')
fprintf(' %4.1f %4.1f %4.1f %4.1f ', [kiloWatt,btu,hp,footLbs].')
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.