244 98 MATLAB kode til behandling af <strong>for</strong>søgsdata 245 % Calculating the model of data. 246 predCF(1) = 1; 247 <strong>for</strong> k = 2:17 248 predCF(k) = predYF(k−1)*15+predCF(k−1); 249 end 250 % Plot the model of data with datapoints. 251 subplot(1,2,2) 252 plot(Time,Cdata,'.b','MarkerSize',15) 253 hold on 254 plot(Time,predCF,'r','linewidth',2) 255 xlabel('Time [min]','fontsize',14); ylabel('Q','fontsize',14); 256 legend('Data','dQ/dt = bQ') 257 axis([0 Time(end) 0 1]) 258 set(get(h,'CurrentAxes'),'fontsize',14) 259 print('−depsc', '−tiff', ['modelF']) 260 print('−dpng', '−loose', ['modelF']) 261 262 % Calculating Sum of Square Errors and AIC 263 diffF = Cdata − predCF'; 264 SSEF = diffF'*diffF; 265 KF = length(DF); 266 AICF = n*log(SSEF/n)+2*KF; 267 268 % <strong>Model</strong> G 269 % Defining matrix X and finding parameters. 270 XG = [ones(16,1)]; 271 DG = pinv(XG)*Y; 272 273 % Calculating the model of Y. 274 predYG = XG*DG; 275 % Plot of the model of Y with datapoints. 276 h = figure; 277 subplot(1,2,1) 278 plot(Time(2:end),Y,'b','linewidth',2) 279 hold on 280 plot(Time(2:end),predYG,'r','linewidth',2) 281 xlabel('Time [min]','fontsize',14); ylabel('dQ/dt','fontsize',14); 282 axis tight 283 284 % Calculating the model of data. 285 predCG(1) = 1; 286 <strong>for</strong> k = 2:17 287 predCG(k) = predYG(k−1)*15+predCG(k−1); 288 end 289 % Plot the model of data with datapoints. 290 subplot(1,2,2) 291 plot(Time,Cdata,'.b','MarkerSize',15) 292 hold on 293 plot(Time,predCG,'r','linewidth',2) 294 xlabel('Time [min]','fontsize',14); ylabel('Q','fontsize',14); 295 legend('Data','dQ/dt = c') 296 axis([0 Time(end) 0 1]) 297 set(get(h,'CurrentAxes'),'fontsize',14) 298 print('−depsc', '−tiff', ['modelG'])
299 print('−dpng', '−loose', ['modelG']) 300 301 % Calculating Sum of Square Errors and AIC 302 diffG = Cdata − predCG'; 303 SSEG = diffG'*diffG; 304 KG = length(DG); 305 AICG = n*log(SSEG/n)+2*KG; 99