%% TpB - Matlab code to complete
% Date
% Group number and names
% -------------------------------------------------------------------------
clear all; 
close all;

% load data: 
load('name.mat');

% convert the temperature data from Kelvin to Celsius: 
Frame = Frame - 273.15;

% plot the matrix 

figure; 
imagesc(Frame)

% determine the x_min, x_max and y_min, y_max for the plate
% to be adjusted!!
ymin = 82;
ymax = 176;
xmin = 52;
xmax = 259;

% -------------------------------------------------------------------------
% crop the matrix to keep only the plate area
newFrame = Frame(ymin:ymax, xmin:xmax);

% adapt from pixel to centimeter: 
% distance over x = 17 cm
% distance over y = 7 cm

y_matrix = size(newFrame, 1)*7/(ymax-ymin);
x_matrix = size(newFrame, 2)*17/(xmax-xmin);
display_factor = 50; %can be changed, it is only a window display factor

% -------------------------------------------------------------------------
% Plot the plate image and add colorbar, change colomap, add ticks (cm)
fig = figure; 
image(newFrame, 'CDataMapping', 'scaled')
xticklabels = 0:1:x_matrix;
xticks = linspace(1, size(newFrame, 2), numel(xticklabels));
set(gca, 'XTick', xticks, 'XtickLabel', xticklabels)
yticklabels = 0:1:y_matrix;
yticks = linspace(1, size(newFrame, 1), numel(yticklabels));
set(gca, 'YTick', yticks, 'YtickLabel', yticklabels)
colorbar
colormap(jet)
caxis([50 55]) % to be adjusted
truesize([y_matrix*display_factor x_matrix*display_factor])

% -------------------------------------------------------------------------
% To check: plot the temperature over x for all y (use a for loop)


% -------------------------------------------------------------------------
% To check: plot the temperature over y for a specific x


% -------------------------------------------------------------------------
% Rest of the code: 
% ...



