clc; clear all; close all;

%extracting values from 42 stages:
reflux42                = xlsread('M:\Diplom\kaibel_test_results_working_prefrac_split.xls','sheet1','b7:b35');
tempprofilecolumn1_42   = xlsread('M:\Diplom\kaibel_test_results_working_prefrac_split.xls','sheet1','c7:ad35');
tempprofilecolumn2_42   = xlsread('M:\Diplom\kaibel_test_results_working_prefrac_split.xls','sheet1','ae7:ar35');
%heatduty42              = xlsread('M:\Diplom\kaibel_test_results_working_prefrac_split.xls','sheet1','as7:as35');
%sumx42                  = xlsread('M:\Diplom\kaibel_test_results_working_prefrac_split.xls','sheet1','bu7:bu35');
%nstage42                = xlsread('M:\Diplom\kaibel_test_results_working_prefrac_split.xls','sheet1','br7:br7');

%extracting values from 50 stages:
reflux50                = xlsread('M:\Diplom\kaibel_50stages_reflux12.xls','sheet1','b7:b28');
tempprofilecolumn1_50   = xlsread('M:\Diplom\kaibel_50stages_reflux12.xls','sheet1','c7:ai28');
tempprofilecolumn2_50   = xlsread('M:\Diplom\kaibel_50stages_reflux12.xls','sheet1','aj7:az28');
%heatduty50              = xlsread('M:\Diplom\kaibel_50stages_reflux12.xls','sheet1','ba7:ba28');
%sumx50                  = xlsread('M:\Diplom\kaibel_50stages_reflux12.xls','sheet1','cb7:cb28');
%nstage50                = xlsread('M:\Diplom\kaibel_50stages_reflux12.xls','sheet1','bz7:bz7');

%extracting values from 59 stages:
reflux59                = xlsread('M:\Diplom\kaibel_59stages_reflux12.xls','sheet1','b7:b20');
tempprofilecolumn1_59   = xlsread('M:\Diplom\kaibel_59stages_reflux12.xls','sheet1','c7:ao20');
tempprofilecolumn2_59   = xlsread('M:\Diplom\kaibel_59stages_reflux12.xls','sheet1','ap7:bi20');
%heatduty59              = xlsread('M:\Diplom\kaibel_59stages_reflux12.xls','sheet1','bj7:bj20');
%sumx59                  = xlsread('M:\Diplom\kaibel_59stages_reflux12.xls','sheet1','ck7:ck20');
%nstage59                = xlsread('M:\Diplom\kaibel_59stages_reflux12.xls','sheet1','ci7:ci7');


%stage scaling

cs1_42 = 6;     cs1_50 = 7;     cs1_59 = 8;
cs2_42 = 23;    cs2_50 = 27;    cs2_59 = 31;

%42 stage scaling
[run42,size42_1] = size(tempprofilecolumn1_42);
[run42,size42_2] = size(tempprofilecolumn2_42);
n1_42 = (1:size42_1);
n2_42 = [(1:cs1_42) (linspace(cs1_42+1,cs2_42-1,size42_2)) (cs2_42:size42_1)];
tempprofilecolumn2_42 = [tempprofilecolumn1_42(:,1:cs1_42) tempprofilecolumn2_42 tempprofilecolumn1_42(:,cs2_42:size42_1)];

%50 stage scaling
[run50,size50_1] = size(tempprofilecolumn1_50);
[run50,size50_2] = size(tempprofilecolumn2_50);
n1_50 = (1:size50_1);
n2_50 = [(1:cs1_50) (linspace(cs1_50+1,cs2_50-1,size50_2)) (cs2_50:size50_1)];
tempprofilecolumn2_50 = [tempprofilecolumn1_50(:,1:cs1_50) tempprofilecolumn2_50 tempprofilecolumn1_50(:,cs2_50:size50_1)];
n1_50 = n1_50.*(size42_1/size50_1);
n2_50 = n2_50.*(size42_1/size50_1);

%50 stage scaling
[run59,size59_1] = size(tempprofilecolumn1_59);
[run59,size59_2] = size(tempprofilecolumn2_59);
n1_59 = (1:size59_1);
n2_59 = [(1:cs1_59) (linspace(cs1_59+1,cs2_59-1,size59_2)) (cs2_59:size59_1)];
tempprofilecolumn2_59 = [tempprofilecolumn1_59(:,1:cs1_59) tempprofilecolumn2_59 tempprofilecolumn1_59(:,cs2_59:size59_1)];
n1_59 = n1_59.*(size42_1/size59_1);
n2_59 = n2_59.*(size42_1/size59_1);


x=6;
reflux42(x)
reflux50(x)
reflux59(x)

figure(1)
hold on
%plot(n1_42,tempprofilecolumn1_42(x,:),'-b',n1_50,tempprofilecolumn1_50(x,:),'-.k',n1_59,tempprofilecolumn1_59(x,:),'--r')
plot(n2_42,tempprofilecolumn2_42(x,:),'-b',n2_50,tempprofilecolumn2_50(x,:),'-.k',n2_59,tempprofilecolumn2_59(x,:),'--r')
legend('42 stages','50 stages','59 stages')
xlabel('Stage number'), ylabel('Temperature [K]')

