clear;clc;
randn('seed',100)
Dat_len = 800;                           % Number_data
ts = 0.1;                                % sampling interval
F2 = 5 + ones(1,Dat_len);                % manipulated variable
T2 = 100 + randn(1,Dat_len)*0.8;         % measued disturbance
A2 = 20 + randn(1,Dat_len)*2;;           % measured disturbance
[A1,t] = process('reset');               % initial process
%=====================================================================%
% 以下程式碼，必須出現在答案中，行向量列向量可轉換。
% randn('seed',100)
% Dat_len = 800;
% ts = 0.1;
% T2 = 100 + randn(1,Dat_len)*0.8;
% A2 = 20 + randn(1,Dat_len)*2;;
% [A1,t] = process('reset');
%=====================================================================%
for i = 1:Dat_len-1
    t1 = ts*(i-1);
    %  Operated process
    [y_tmp, t_tmp] = process(t1,F2(i),T2(i),A2(i));
    A1 = [A1; y_tmp];
    t = [t; t_tmp];
    %=====================================================================%
    % 以下程式碼，必須出現在答案中，行向量列向量可轉換。
    % t1 = ts*(i-1);
    % [y_tmp, t_tmp] = process(t1,F2(i),T2(i),A2(i));
    % A1 = [A1; y_tmp];
    % t = [t; t_tmp];
    %=====================================================================%
end

figure(1)
plot(t,A1);
xlabel('Time points');ylabel('Exit Conc.')

figure(2)
plot(t,T2,t,A2);
xlabel('Time points');ylabel('Exit Conc.')
legend('Temp.', 'Feed Conc.')
