% AT STEP 82: CALCULATES SISO FIR MODEL FOR CV ASVSTPSGCA FROM MV/DV GASFODE

% MATLAB SCRIPT STARTS .......

FIR_ASVSTPSGCA_GASFODE_uraw = [624000 624000 624000 624000 624000 624000 624000 624000 624000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 ]';
FIR_ASVSTPSGCA_GASFODE_yraw = [1.00262 1.00257 1.00254 1.0025 1.00248 1.00246 1.00243 1.0024 1.00236 1.06505 1.24568 1.28111 1.382 1.47049 1.5696 1.69249 1.85368 2.1426 2.39088 2.66604 2.88884 3.09317 3.31874 3.4401 3.51869 3.60031 3.64879 3.67314 3.66845 3.63734 3.5934 3.50367 3.40668 3.30163 3.2053 3.0941 2.98199 2.87446 2.72174 2.67869 2.63478 2.6046 2.61542 2.78481 2.6749 2.66195 2.65334 2.64509 2.63588 2.62613 2.6165 2.60637 2.59588 2.58453 2.57548 2.56503 2.55634 2.54779 2.54023 2.5347 2.52913 2.5225 2.51691 2.5098 2.50503 2.50068 2.49766 2.49489 2.49185 2.48882 2.48623 2.48307 2.47952 2.47665 2.47362 2.47045 2.46721 2.46362 2.45988 2.45715 ]';
FIR_ASVSTPSGCA_GASFODE_yfilt = [1.00262 1.00257 1.00254 1.0025 1.00248 1.00246 1.00243 1.0024 1.00236 1.06505 1.24568 1.28111 1.382 1.47049 1.5696 1.69249 1.85368 2.1426 2.39088 2.66604 2.88884 3.09317 3.31874 3.4401 3.51869 3.60031 3.64879 3.67314 3.66845 3.63734 3.5934 3.50367 3.40668 3.30163 3.2053 3.0941 2.98199 2.87446 2.72174 2.67869 2.63478 2.6046 2.61542 2.78481 2.6749 2.66195 2.65334 2.64509 2.63588 2.62613 2.6165 2.60637 2.59588 2.58453 2.57548 2.56503 2.55634 2.54779 2.54023 2.5347 2.52913 2.5225 2.51691 2.5098 2.50503 2.50068 2.49766 2.49489 2.49185 2.48882 2.48623 2.48307 2.47952 2.47665 2.47362 2.47045 2.46721 2.46362 2.45988 2.45715 ]';
FIR_ASVSTPSGCA_GASFODE_u = [624000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 ]';
FIR_ASVSTPSGCA_GASFODE_y = [1.00236 1.06505 1.24568 1.28111 1.382 1.47049 1.5696 1.69249 1.85368 2.1426 2.39088 2.66604 2.88884 3.09317 3.31874 3.4401 3.51869 3.60031 3.64879 3.67314 3.66845 3.63734 3.5934 3.50367 3.40668 3.30163 3.2053 3.0941 2.98199 2.87446 2.72174 2.67869 2.63478 2.6046 2.61542 2.78481 2.6749 2.66195 2.65334 2.64509 2.63588 2.62613 2.6165 2.60637 2.59588 2.58453 2.57548 2.56503 2.55634 2.54779 2.54023 2.5347 2.52913 2.5225 2.51691 2.5098 2.50503 2.50068 2.49766 2.49489 2.49185 2.48882 2.48623 2.48307 2.47952 2.47665 2.47362 2.47045 2.46721 2.46362 2.45988 2.45715 ]';
FIR_ASVSTPSGCA_GASFODE_ymod = [1.00236 1.06505 1.24568 1.28111 1.382 1.47049 1.5696 1.69249 1.85368 2.1426 2.39088 2.66604 2.88884 3.09317 3.31874 3.4401 3.51869 3.60031 3.64879 3.67314 3.66845 3.63734 3.5934 3.50367 3.40668 3.30163 3.2053 3.0941 2.98199 2.87446 2.72174 2.67869 2.63478 2.6046 2.61542 2.78481 2.6749 2.66195 2.65334 2.64509 2.63588 2.62613 2.6165 2.60637 2.59588 2.58453 2.57548 2.56503 2.55634 2.54779 2.54023 2.5347 2.52913 2.5225 2.51691 2.5098 2.50503 2.50068 2.49766 2.49489 2.49185 2.48882 2.48623 2.48307 2.47952 2.47665 2.47362 2.47045 2.46721 2.46362 2.45988 2.45715 ]';
FIR_ASVSTPSGCA_GASFODE = [-1.56717e-006 -6.08309e-006 -6.96869e-006 -9.491e-006 -1.17031e-005 -1.41811e-005 -1.72532e-005 -2.12829e-005 -2.8506e-005 -3.4713e-005 -4.15919e-005 -4.71619e-005 -5.22703e-005 -5.79095e-005 -6.09434e-005 -6.29084e-005 -6.49489e-005 -6.61609e-005 -6.67696e-005 -6.66523e-005 -6.58745e-005 -6.47761e-005 -6.25329e-005 -6.01079e-005 -5.74818e-005 -5.50736e-005 -5.22935e-005 -4.94907e-005 -4.68026e-005 -4.29845e-005 -4.19083e-005 -4.08106e-005 -4.00559e-005 -4.03264e-005 -4.45612e-005 -4.18135e-005 -4.14898e-005 -4.12744e-005 -4.10682e-005 -4.0838e-005 -4.05943e-005 -4.03536e-005 -4.01003e-005 -3.98381e-005 -3.95543e-005 -3.9328e-005 -3.90668e-005 -3.88496e-005 -3.86357e-005 -3.84468e-005 -3.83086e-005 -3.81694e-005 -3.80036e-005 -3.78638e-005 -3.76859e-005 -3.75668e-005 -3.7458e-005 -3.73826e-005 -3.73133e-005 -3.72372e-005 -3.71614e-005 -3.70969e-005 -3.70178e-005 -3.69291e-005 -3.68573e-005 -3.67814e-005 -3.67023e-005 -3.66212e-005 -3.65316e-005 -3.64379e-005 -3.63698e-005 ]';
FIR_ASVSTPSGCA_GASFODE_u_wndw0 = [624000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 584000 ]';
FIR_ASVSTPSGCA_GASFODE_y_wndw0 = [1.00236 1.06505 1.24568 1.28111 1.382 1.47049 1.5696 1.69249 1.85368 2.1426 2.39088 2.66604 2.88884 3.09317 3.31874 3.4401 3.51869 3.60031 3.64879 3.67314 3.66845 3.63734 3.5934 3.50367 3.40668 3.30163 3.2053 3.0941 2.98199 2.87446 2.72174 2.67869 2.63478 2.6046 2.61542 2.78481 2.6749 2.66195 2.65334 2.64509 2.63588 2.62613 2.6165 2.60637 2.59588 2.58453 2.57548 2.56503 2.55634 2.54779 2.54023 2.5347 2.52913 2.5225 2.51691 2.5098 2.50503 2.50068 2.49766 2.49489 2.49185 2.48882 2.48623 2.48307 2.47952 2.47665 2.47362 2.47045 2.46721 2.46362 2.45988 2.45715 ]';
FIR_ASVSTPSGCA_GASFODE_ymod_wndw0 = [1.00236 1.06505 1.24568 1.28111 1.382 1.47049 1.5696 1.69249 1.85368 2.1426 2.39088 2.66604 2.88884 3.09317 3.31874 3.4401 3.51869 3.60031 3.64879 3.67314 3.66845 3.63734 3.5934 3.50367 3.40668 3.30163 3.2053 3.0941 2.98199 2.87446 2.72174 2.67869 2.63478 2.6046 2.61542 2.78481 2.6749 2.66195 2.65334 2.64509 2.63588 2.62613 2.6165 2.60637 2.59588 2.58453 2.57548 2.56503 2.55634 2.54779 2.54023 2.5347 2.52913 2.5225 2.51691 2.5098 2.50503 2.50068 2.49766 2.49489 2.49185 2.48882 2.48623 2.48307 2.47952 2.47665 2.47362 2.47045 2.46721 2.46362 2.45988 2.45715 ]';
figure(1)
subplot(2,1,1)
plot(FIR_ASVSTPSGCA_GASFODE_uraw)
grid
xlabel('GASFODE raw data');
title('Data for ASVSTPSGCA and GASFODE');
subplot(2,1,2)
plot([FIR_ASVSTPSGCA_GASFODE_yraw FIR_ASVSTPSGCA_GASFODE_yfilt])
grid
xlabel('ASVSTPSGCA raw and filtered');
figure(2)
subplot(3,1,1)
plot(FIR_ASVSTPSGCA_GASFODE_u)
grid
xlabel('GASFODE');
title('Modeling ASVSTPSGCA from steps in GASFODE');
subplot(3,1,2)
plot([FIR_ASVSTPSGCA_GASFODE_y FIR_ASVSTPSGCA_GASFODE_ymod])
grid
xlabel('ASVSTPSGCA measured and model');
subplot(3,1,3)
plot(FIR_ASVSTPSGCA_GASFODE)
xlabel('Step response');

figure(3)
subplot(2,1,1)
plot(FIR_ASVSTPSGCA_GASFODE_u_wndw0)
grid
xlabel('GASFODE');
title('Data window #1: Modeling ASVSTPSGCA from steps in GASFODE');
subplot(2,1,2)
plot([FIR_ASVSTPSGCA_GASFODE_y_wndw0 FIR_ASVSTPSGCA_GASFODE_ymod_wndw0])
grid
xlabel('ASVSTPSGCA measured and model');

% MATLAB SCRIPT ENDS .......

