Graphical display of adjusted data FORMAT [Y y beta Bcov] = spm_graph(xSPM,SPM,hReg) SPM - structure containing SPM, distributional & filtering details about the excusion set SPM - structure containing generic details about the analysis hReg - handle of MIP register Y - fitted data for the selected voxel y - adjusted data for the selected voxel beta - parameter estimates (ML or MAP) Bcov - Covariance of parameter estimates (ML or conditional) see spm_getSPM for details _______________________________________________________________________ spm_graph is a Callback script that uses the structures above to: (i) send adjusted (y) and fitted data (Y), for the selected voxel, to the workspace and (ii) provide graphics for: a) Contrasts of parameter estimates (e.g. activations) and their standard error. b) Fitted and adjusted responses that can be plotted against time, scan, or an indicator variable in the design matrix. c) (fMRI only). Evoked responses using the basis functions to give impulse responses that would have been seen in the absence of other effects. Getting adjusted data: Ensuring the data are adjusted properly can be important (e.g. in constructing explanatory variables such as in a psychophysiological interaction). To remove or correct for specific effects, specify an appropriate F contrast and simply plot the fitted (and adjusted) responses after selecting that F contrast. The vectors Y (fitted) and y (adjusted) in the workspace will now be corrected for the effects in the reduced design matrix (X0) specified in the contrast manager with the column indices (iX0) of the confounds in this adjustment. Plotting data: All data and graphics use filtered/whitened data and residuals. In PET studies the parameter estimates and the fitted data are often the same because the explanatory variables are simply indicator variables taking the value of one. Only contrasts previously defined can be plotted. This ensures that the parameters plotted are meaningful even when there is collinearity among the design matrix subpartitions. Selecting contrasts used for PPMs will automatically give plots based on conditonal estimates. _______________________________________________________________________ @(#)spm_graph.m 2.40 Karl Friston 03/03/25
0001 function [Y,y,beta,Bcov] = spm_graph(xSPM,SPM,hReg) 0002 % Graphical display of adjusted data 0003 % FORMAT [Y y beta Bcov] = spm_graph(xSPM,SPM,hReg) 0004 % 0005 % SPM - structure containing SPM, distributional & filtering details 0006 % about the excusion set 0007 % SPM - structure containing generic details about the analysis 0008 % hReg - handle of MIP register 0009 % 0010 % Y - fitted data for the selected voxel 0011 % y - adjusted data for the selected voxel 0012 % beta - parameter estimates (ML or MAP) 0013 % Bcov - Covariance of parameter estimates (ML or conditional) 0014 % 0015 % see spm_getSPM for details 0016 %_______________________________________________________________________ 0017 % 0018 % spm_graph is a Callback script that uses the structures above to: (i) 0019 % send adjusted (y) and fitted data (Y), for the selected voxel, to the 0020 % workspace and (ii) provide graphics for: 0021 % 0022 % a) Contrasts of parameter estimates (e.g. activations) and their 0023 % standard error. 0024 % 0025 % b) Fitted and adjusted responses that can be plotted against time, 0026 % scan, or an indicator variable in the design matrix. 0027 % 0028 % c) (fMRI only). Evoked responses using the basis functions to give 0029 % impulse responses that would have been seen in the absence of other effects. 0030 % 0031 % Getting adjusted data: 0032 % Ensuring the data are adjusted properly can be important (e.g. in 0033 % constructing explanatory variables such as in a psychophysiological 0034 % interaction). To remove or correct for specific effects, specify an 0035 % appropriate F contrast and simply plot the fitted (and adjusted) 0036 % responses after selecting that F contrast. The vectors Y (fitted) 0037 % and y (adjusted) in the workspace will now be corrected for the 0038 % effects in the reduced design matrix (X0) specified in the contrast 0039 % manager with the column indices (iX0) of the confounds in this 0040 % adjustment. 0041 % 0042 % Plotting data: 0043 % All data and graphics use filtered/whitened data and residuals. In PET 0044 % studies the parameter estimates and the fitted data are often the same 0045 % because the explanatory variables are simply indicator variables taking 0046 % the value of one. Only contrasts previously defined can be plotted. 0047 % This ensures that the parameters plotted are meaningful even when there 0048 % is collinearity among the design matrix subpartitions. 0049 % 0050 % Selecting contrasts used for PPMs will automatically give plots 0051 % based on conditonal estimates. 0052 % 0053 %_______________________________________________________________________ 0054 % @(#)spm_graph.m 2.40 Karl Friston 03/03/25 0055 0056 0057 %-Get Graphics figure handle 0058 %----------------------------------------------------------------------- 0059 Fgraph = spm_figure('GetWin','Graphics'); 0060 0061 0062 %-Delete previous axis and their pagination controls (if any) 0063 %----------------------------------------------------------------------- 0064 spm_results_ui('Clear',Fgraph,2); 0065 0066 0067 %-Find nearest voxel [Euclidean distance] in point list & update GUI 0068 %----------------------------------------------------------------------- 0069 if ~length(xSPM.XYZmm) 0070 spm('alert!','No suprathreshold voxels!',mfilename,0); 0071 0072 Y = []; y = []; beta = []; Bcov = []; 0073 return 0074 end 0075 0076 [xyz,i] = spm_XYZreg('NearestXYZ',spm_XYZreg('GetCoords',hReg),xSPM.XYZmm); 0077 spm_XYZreg('SetCoords',xyz,hReg); 0078 XYZ = xSPM.XYZ(:,i); % coordinates 0079 0080 0081 %-Extract filtered and whitened data from files 0082 %======================================================================= 0083 try 0084 y = spm_get_data(SPM.xY.VY,XYZ); 0085 y = spm_filter(SPM.xX.K,SPM.xX.W*y); 0086 catch 0087 try 0088 % remap files in SPM.xY.P if SPM.xY.VY is no longer valid 0089 %------------------------------------------------------- 0090 SPM.xY.VY = spm_vol(SPM.xY.P); 0091 y = spm_get_data(SPM.xY.VY,XYZ); 0092 y = spm_filter(SPM.xX.K,SPM.xX.W*y); 0093 0094 catch 0095 % data has been moved or renamed 0096 %------------------------------------------------------- 0097 y = []; 0098 spm('alert!',{'Original data have been moved or renamed',... 0099 'Recomendation: please update SPM.xY.P'},... 0100 mfilename,0); 0101 end 0102 end 0103 XYZstr = sprintf(' at [%g, %g, %g]',xyz); 0104 0105 0106 %-Compute residuals 0107 %----------------------------------------------------------------------- 0108 if isempty(y) 0109 0110 % make R = NaN so it will not be plotted 0111 %--------------------------------------------------------------- 0112 R = NaN*ones(size(SPM.xX.X,1),1); 0113 0114 else 0115 % residuals (non-whitened) 0116 %--------------------------------------------------------------- 0117 R = spm_sp('r',SPM.xX.xKXs,y); 0118 0119 end 0120 0121 %-Get parameter and hyperparameter estimates 0122 %======================================================================= 0123 if xSPM.STAT ~= 'P' 0124 0125 %-Parameter estimates: beta = xX.pKX*xX.K*y; 0126 %-Residual mean square: ResMS = sum(R.^2)/xX.trRV 0127 %--------------------------------------------------------------- 0128 beta = spm_get_data(SPM.Vbeta, XYZ); 0129 ResMS = spm_get_data(SPM.VResMS,XYZ); 0130 Bcov = ResMS*SPM.xX.Bcov; 0131 0132 else 0133 % or conditional estimates with 0134 % Cov(b|y) through Taylor approximation 0135 %--------------------------------------------------------------- 0136 beta = spm_get_data(SPM.VCbeta, XYZ); 0137 0138 if isfield(SPM.PPM,'VB'); 0139 % Get approximate posterior covariance at ic 0140 % using Taylor-series approximation 0141 0142 % Get posterior SD beta's 0143 Nk=size(SPM.xX.X,2); 0144 for k=1:Nk, 0145 sd_beta(k,:) = spm_get_data(SPM.VPsd(k),XYZ); 0146 end 0147 0148 % Get AR coefficients 0149 for p=1:SPM.PPM.AR_P 0150 a(p,:) = spm_get_data(SPM.VAR(p),XYZ); 0151 end 0152 0153 % Get noise SD 0154 lambda = spm_get_data(SPM.VHp,XYZ); 0155 0156 % Which slice are we in ? 0157 slice_index=XYZ(3,1); 0158 0159 % Reconstuct approximation to voxel wise correlation matrix 0160 post_R=SPM.PPM.slice(slice_index).mean.R; 0161 dh=a(:,1)'-SPM.PPM.slice(slice_index).mean.a; 0162 dh=[dh lambda(1)-SPM.PPM.slice(slice_index).mean.lambda]; 0163 for i=1:length(dh), 0164 post_R=post_R+SPM.PPM.slice(slice_index).mean.dR(:,:,i)*dh(i); 0165 end 0166 % Reconstuct approximation to voxel wise covariance matrix 0167 Bcov = (sd_beta(:,1)*sd_beta(:,1)').*post_R; 0168 0169 0170 else 0171 Bcov = SPM.PPM.Cby; 0172 for j = 1:length(SPM.PPM.l) 0173 0174 l = spm_get_data(SPM.VHp(j),XYZ); 0175 Bcov = Bcov + SPM.PPM.dC{j}*(l - SPM.PPM.l(j)); 0176 end 0177 end 0178 end 0179 CI = 1.6449; % = spm_invNcdf(1 - 0.05); 0180 0181 0182 %-Colour specifications and index; 0183 %----------------------------------------------------------------------- 0184 Col = [0 0 0; .8 .8 .8; 1 .5 .5]; 0185 0186 %-Plot 0187 %======================================================================= 0188 0189 % find out what to plot 0190 %----------------------------------------------------------------------- 0191 Cplot = { 'Contrast estimates and 90% C.I.',... 0192 'Fitted responses',... 0193 'Event-related responses',... 0194 'Parametric responses',... 0195 'Volterra Kernels'}; 0196 0197 0198 % ensure options are appropriate 0199 %----------------------------------------------------------------------- 0200 try 0201 Sess = SPM.Sess; 0202 catch 0203 Cplot = Cplot(1:2); 0204 end 0205 Cplot = Cplot{spm_input('Plot',-1,'m',Cplot)}; 0206 0207 switch Cplot 0208 0209 % select contrast if 0210 %---------------------------------------------------------------------- 0211 case {'Contrast estimates and 90% C.I.','Fitted responses'} 0212 0213 % determine which contrast 0214 %--------------------------------------------------------------- 0215 Ic = spm_input('Which contrast?','!+1','m',{SPM.xCon.name}); 0216 TITLE = {Cplot SPM.xCon(Ic).name}; 0217 if xSPM.STAT == 'P' 0218 TITLE = {Cplot SPM.xCon(Ic).name '(conditional estimates)'}; 0219 end 0220 0221 0222 % select session and trial if 0223 %---------------------------------------------------------------------- 0224 case {'Event-related responses','Parametric responses','Volterra Kernels'} 0225 0226 % get session 0227 %-------------------------------------------------------------- 0228 s = length(Sess); 0229 if s > 1 0230 s = spm_input('which session','+1','n1',1,s); 0231 end 0232 0233 % effect names 0234 %-------------------------------------------------------------- 0235 switch Cplot 0236 case 'Volterra Kernels' 0237 u = length(Sess(s).Fc); 0238 otherwise 0239 u = length(Sess(s).U); 0240 end 0241 Uname = {}; 0242 for i = 1:u 0243 Uname{i} = Sess(s).Fc(i).name; 0244 end 0245 0246 % get effect 0247 %-------------------------------------------------------------- 0248 str = sprintf('which effect'); 0249 u = spm_input(str,'+1','m',Uname); 0250 0251 % bin size 0252 %-------------------------------------------------------------- 0253 dt = SPM.xBF.dt; 0254 0255 end 0256 0257 switch Cplot 0258 0259 % plot parameter estimates 0260 %---------------------------------------------------------------------- 0261 case 'Contrast estimates and 90% C.I.' 0262 0263 % compute contrast of parameter estimates and 90% C.I. 0264 %-------------------------------------------------------------- 0265 cbeta = SPM.xCon(Ic).c'*beta; 0266 CI = CI*sqrt(diag(SPM.xCon(Ic).c'*Bcov*SPM.xCon(Ic).c)); 0267 0268 % bar chart 0269 %-------------------------------------------------------------- 0270 figure(Fgraph) 0271 subplot(2,1,2) 0272 cla 0273 hold on 0274 0275 % estimates 0276 %-------------------------------------------------------------- 0277 h = bar(cbeta); 0278 set(h,'FaceColor',Col(2,:)) 0279 0280 % standard error 0281 %-------------------------------------------------------------- 0282 for j = 1:length(cbeta) 0283 line([j j],([CI(j) 0 - CI(j)] + cbeta(j)),... 0284 'LineWidth',6,'Color',Col(3,:)) 0285 end 0286 0287 title(TITLE,'FontSize',12) 0288 xlabel('contrast') 0289 ylabel(['contrast estimate',XYZstr]) 0290 set(gca,'XLim',[0.4 (length(cbeta) + 0.6)]) 0291 hold off 0292 0293 % set Y to empty so outputs are assigned 0294 %------------------------------------------------------------- 0295 Y = []; 0296 0297 % all fitted effects or selected effects 0298 %----------------------------------------------------------------------- 0299 case 'Fitted responses' 0300 0301 % predicted or adjusted response 0302 %--------------------------------------------------------------- 0303 str = 'predicted or adjusted response?'; 0304 if spm_input(str,'!+1','b',{'predicted','adjusted'},[1 0]); 0305 0306 % fitted (predicted) data (Y = X1*beta) 0307 %-------------------------------------------------------- 0308 Y = SPM.xX.X*SPM.xCon(Ic).c*pinv(SPM.xCon(Ic).c)*beta; 0309 else 0310 0311 % fitted (corrected) data (Y = X1o*beta) 0312 %------------------------------------------------------- 0313 Y = spm_FcUtil('Yc',SPM.xCon(Ic),SPM.xX.xKXs,beta); 0314 0315 end 0316 0317 % adjusted data 0318 %--------------------------------------------------------------- 0319 y = Y + R; 0320 0321 % get ordinates 0322 %--------------------------------------------------------------- 0323 Xplot = { 'an explanatory variable',... 0324 'scan or time',... 0325 'a user specified ordinate'}; 0326 Cx = spm_input('plot against','!+1','m',Xplot); 0327 0328 % an explanatory variable 0329 %--------------------------------------------------------------- 0330 if Cx == 1 0331 0332 str = 'Which explanatory variable?'; 0333 i = spm_input(str,'!+1','m',SPM.xX.name); 0334 x = SPM.xX.xKXs.X(:,i); 0335 XLAB = SPM.xX.name{i}; 0336 0337 % scan or time 0338 %--------------------------------------------------------------- 0339 elseif Cx == 2 0340 0341 if isfield(SPM.xY,'RT') 0342 x = SPM.xY.RT*[1:size(Y,1)]'; 0343 XLAB = 'time {seconds}'; 0344 else 0345 x = [1:size(Y,1)]'; 0346 XLAB = 'scan number'; 0347 end 0348 0349 % user specified 0350 %--------------------------------------------------------------- 0351 elseif Cx == 3 0352 0353 x = spm_input('enter ordinate','!+1','e','',size(Y,1)); 0354 XLAB = 'ordinate'; 0355 0356 end 0357 0358 % plot 0359 %--------------------------------------------------------------- 0360 figure(Fgraph) 0361 subplot(2,1,2) 0362 cla 0363 hold on 0364 [p q] = sort(x); 0365 if all(diff(x(q))) 0366 plot(x(q),Y(q),'LineWidth',4,'Color',Col(2,:)); 0367 plot(x(q),y(q),':','Color',Col(1,:)); 0368 plot(x(q),y(q),'.','MarkerSize',8, 'Color',Col(3,:)); 0369 0370 else 0371 plot(x(q),Y(q),'.','MarkerSize',16,'Color',Col(1,:)); 0372 plot(x(q),y(q),'.','MarkerSize',8, 'Color',Col(2,:)); 0373 xlim = get(gca,'XLim'); 0374 xlim = [-1 1]*diff(xlim)/4 + xlim; 0375 set(gca,'XLim',xlim) 0376 0377 end 0378 title(TITLE,'FontSize',12) 0379 xlabel(XLAB) 0380 ylabel(['response',XYZstr]) 0381 legend('fitted','plus error') 0382 hold off 0383 0384 % modeling evoked responses based on Sess 0385 %---------------------------------------------------------------------- 0386 case 'Event-related responses' 0387 0388 % get plot type 0389 %-------------------------------------------------------------- 0390 Rplot = { 'fitted response and PSTH',... 0391 'fitted response and 90% C.I.',... 0392 'fitted response and adjusted data'}; 0393 0394 if isempty(y) 0395 TITLE = Rplot{2}; 0396 else 0397 TITLE = Rplot{spm_input('plot in terms of','+1','m',Rplot)}; 0398 end 0399 0400 % plot 0401 %-------------------------------------------------------------- 0402 switch TITLE 0403 case 'fitted response and PSTH' 0404 0405 0406 % build a simple FIR model subpartition (X); bin size = TR 0407 %------------------------------------------------------ 0408 BIN = SPM.xY.RT; 0409 %BIN = max(2,BIN); 0410 xBF = SPM.xBF; 0411 U = Sess(s).U(u); 0412 U.u = U.u(:,1); 0413 xBF.name = 'Finite Impulse Response'; 0414 xBF.order = round(32/BIN); 0415 xBF.length = xBF.order*BIN; 0416 xBF = spm_get_bf(xBF); 0417 BIN = xBF.length/xBF.order; 0418 X = spm_Volterra(U,xBF.bf,1); 0419 k = SPM.nscan(s); 0420 X = X([0:(k - 1)]*SPM.xBF.T + SPM.xBF.T0 + 32,:); 0421 0422 % place X in SPM.xX.X 0423 %------------------------------------------------------ 0424 jX = Sess(s).row; 0425 iX = Sess(s).col(Sess(s).Fc(u).i); 0426 iX0 = [1:size(SPM.xX.X,2)]; 0427 iX0(iX) = []; 0428 X = [X SPM.xX.X(jX,iX0)]; 0429 X = SPM.xX.W(jX,jX)*X; 0430 X = [X SPM.xX.K(s).X0]; 0431 0432 % Re-estimate to get PSTH and CI 0433 %------------------------------------------------------ 0434 j = xBF.order; 0435 xX = spm_sp('Set',X); 0436 pX = spm_sp('x-',xX); 0437 PSTH = pX*y(jX); 0438 res = spm_sp('r',xX,y(jX)); 0439 df = size(X,1) - size(X,2); 0440 bcov = pX*pX'*sum(res.^2)/df; 0441 PSTH = PSTH(1:j)/dt; 0442 PST = [1:j]*BIN - BIN/2; 0443 PCI = CI*sqrt(diag(bcov(1:j,(1:j))))/dt; 0444 end 0445 0446 0447 0448 % basis functions and parameters 0449 %-------------------------------------------------------------- 0450 X = SPM.xBF.bf/dt; 0451 x = ([1:size(X,1)] - 1)*dt; 0452 j = Sess(s).col(Sess(s).Fc(u).i(1:size(X,2))); 0453 B = beta(j); 0454 0455 % fitted responses with standard error 0456 %-------------------------------------------------------------- 0457 Y = X*B; 0458 CI = CI*sqrt(diag(X*Bcov(j,j)*X')); 0459 0460 % peristimulus times and adjusted data (y = Y + R) 0461 %-------------------------------------------------------------- 0462 pst = Sess(s).U(u).pst; 0463 bin = round(pst/dt); 0464 q = find((bin >= 0) & (bin < size(X,1))); 0465 y = R(Sess(s).row(:)); 0466 pst = pst(q); 0467 y = y(q) + Y(bin(q) + 1); 0468 0469 0470 0471 % plot 0472 %-------------------------------------------------------------- 0473 figure(Fgraph) 0474 subplot(2,1,2) 0475 hold on 0476 switch TITLE 0477 0478 case 'fitted response and PSTH' 0479 0480 PSTH 0481 %------------------------------------------------------ 0482 errorbar(PST,PSTH,PCI) 0483 plot(PST,PSTH,'LineWidth',4,'Color',Col(2,:)) 0484 plot(x,Y,'-.','Color',Col(3,:)) 0485 0486 case 'fitted response and 90% C.I.' 0487 %------------------------------------------------------ 0488 plot(x,Y,'Color',Col(2,:),'LineWidth',4) 0489 plot(x,Y + CI,'-.',x,Y - CI,'-.','Color',Col(1,:)) 0490 0491 case 'fitted response and adjusted data' 0492 %------------------------------------------------------ 0493 plot(x,Y,'Color',Col(2,:),'LineWidth',4) 0494 plot(pst,y,'.','Color',Col(3,:)) 0495 0496 end 0497 0498 0499 % label 0500 %------------------------------------------------------------- 0501 [i j] = max(Y); 0502 text(ceil(1.1*x(j)),i,Sess(s).Fc(u).name,'FontSize',8); 0503 title(TITLE,'FontSize',12) 0504 xlabel('peristimulus time {secs}') 0505 ylabel(['response',XYZstr]) 0506 hold off 0507 0508 0509 % modeling evoked responses based on Sess 0510 %---------------------------------------------------------------------- 0511 case 'Parametric responses' 0512 0513 0514 % return gracefully if no parameters 0515 %-------------------------------------------------------------- 0516 if ~Sess(s).U(u).P(1).h, return, end 0517 0518 % basis functions 0519 %-------------------------------------------------------------- 0520 bf = SPM.xBF.bf; 0521 pst = ([1:size(bf,1)] - 1)*dt; 0522 0523 % orthogonalised expansion of parameteric variable 0524 %-------------------------------------------------------------- 0525 str = 'which parameter'; 0526 p = spm_input(str,'+1','m',cat(2,Sess(s).U(u).P.name)); 0527 P = Sess(s).U(u).P(p).P; 0528 q = []; 0529 for i = 0:Sess(s).U(u).P(p).h; 0530 q = [q spm_en(P).^i]; 0531 end 0532 q = spm_orth(q); 0533 0534 0535 % parameter estimates for this effect 0536 %-------------------------------------------------------------- 0537 B = beta(Sess(s).Fc(u).i); 0538 0539 % reconstruct trial-specific responses 0540 %-------------------------------------------------------------- 0541 Y = zeros(size(bf,1),size(q,1)); 0542 uj = Sess(s).U(u).P(p).i; 0543 for i = 1:size(P,1) 0544 U = sparse(1,uj,q(i,:),1,size(Sess(s).U(u).u,2)); 0545 X = kron(U,bf); 0546 Y(:,i) = X*B; 0547 end 0548 [P j] = sort(P); 0549 Y = Y(:,j); 0550 0551 % plot 0552 %-------------------------------------------------------------- 0553 figure(Fgraph) 0554 subplot(2,2,3) 0555 surf(pst,P,Y') 0556 shading flat 0557 title(Sess(s).U(u).name{1},'FontSize',12) 0558 xlabel('PST {secs}') 0559 ylabel(Sess(s).U(u).P(p).name) 0560 zlabel(['responses',XYZstr]) 0561 axis square 0562 0563 % plot 0564 %-------------------------------------------------------------- 0565 subplot(2,2,4) 0566 [j i] = max(mean(Y,2)); 0567 plot(P,Y(i,:),'LineWidth',4,'Color',Col(2,:)) 0568 str = sprintf('response at %0.1fs',i*dt); 0569 title(str,'FontSize',12) 0570 xlabel(Sess(s).U(u).P(p).name) 0571 axis square 0572 grid on 0573 0574 0575 % modeling evoked responses based on Sess 0576 %---------------------------------------------------------------------- 0577 case 'Volterra Kernels' 0578 0579 % Parameter estimates and basis functions 0580 %------------------------------------------------------ 0581 bf = SPM.xBF.bf/dt; 0582 pst = ([1:size(bf,1)] - 1)*dt; 0583 0584 % second order kernel 0585 %-------------------------------------------------------------- 0586 if u > length(Sess(s).U) 0587 0588 % Parameter estimates and kernel 0589 %------------------------------------------------------ 0590 B = beta(Sess(s).Fc(u).i); 0591 i = 1; 0592 Y = 0; 0593 for p = 1:size(bf,2) 0594 for q = 1:size(bf,2) 0595 Y = Y + B(i)*bf(:,p)*bf(:,q)'; 0596 i = i + 1; 0597 end 0598 end 0599 0600 % plot 0601 %------------------------------------------------------ 0602 figure(Fgraph) 0603 subplot(2,2,3) 0604 imagesc(pst,pst,Y) 0605 axis xy 0606 axis image 0607 0608 title('2nd order Kernel','FontSize',12); 0609 xlabel('perstimulus time {secs}') 0610 ylabel('perstimulus time {secs}') 0611 0612 subplot(2,2,4) 0613 plot(pst,Y) 0614 axis square 0615 grid on 0616 0617 title(Sess(s).Fc(u).name,'FontSize',12); 0618 xlabel('perstimulus time {secs}') 0619 0620 0621 % first order kernel 0622 %-------------------------------------------------------------- 0623 else 0624 B = beta(Sess(s).Fc(u).i(1:size(bf,2))); 0625 Y = bf*B; 0626 0627 % plot 0628 %------------------------------------------------------ 0629 figure(Fgraph) 0630 subplot(2,1,2) 0631 plot(pst,Y) 0632 grid on 0633 axis square 0634 0635 title({'1st order Volterra Kernel' Sess(s).Fc(u).name},... 0636 'FontSize',12); 0637 xlabel('perstimulus time {secs}') 0638 ylabel(['impluse response',XYZstr]) 0639 end 0640 0641 end 0642 0643 0644 %-call Plot UI 0645 %---------------------------------------------------------------------- 0646 spm_results_ui('PlotUi',gca)