%% Exercise 1
% A slight modification of Tomy Cherian's solution.
%% Fahrenheit to Celsius
% Code of F2C:

type F2C

%

F=-40:100; % Fahrenheit degrees from -40 to 40; 
C=F2C(F);
T1=[F',C'];   % This is enough.
% Look at first 10 rows:
T1(1:10,:)

%
%% Using table (elegant, not required):

T1table=array2table(T1,'VariableNames',{'Fahrenheit','Celsius'});
plot(F,C,'b');
grid on;
xlabel('Fahrenheit(\circ F)');
ylabel('Celsius(\circ C)');
title('Fahrenheit to Celsius');
shg;

%
%% Celsius to Fahrenheit

%Celsius to Fahrenheit
% Code of C2F
type C2F   % need (%%)after,otherwise not shown(for some reason)

%

C=-40:100;% Celsius degrees from -40 to 40; 
F=C2F(C);
T2=[C',F'];

%
%% Table: Elegant (not required), like above

T2table=array2table(T2,'VariableNames',{'Fahrenheit','Celsius'});
T2table(1:10,:)
figure
plot(C,F,'r');
grid on;
xlabel('Celsius(\circ C)')
ylabel('Fahrenheit(\circ F)');
title('Celsius to Fahrenheit');
shg;