% fMRI 
% R. Nowak
% 1/27/03

clear
clf

% load fMRI data and reference signal waveform

% loads 122 x 64 x 64 array called 'x', consisting of 122 brain images
% each image is 64x64 pixels 
% time-length of image sequence = 122

load fmri.mat

% loads 122 x 1 reference signal waveform 
load fmri_sig.mat
s = s-mean(s); % remove average (DC) value
figure(1)
plot(s)
title('Reference signal')

% plot magnitude of fft of reference
figure(2)
plot(abs(fft(s)))
title('Magnitude of DFT of reference signal')

% plot brain at time 1
figure(3)
im = reshape(x(1,:,:),64,64);
image(im/50)
title('Brain image at time t=1')

% plot a pixel at (32,32) as a function of time
figure(4)
y = x(:,32,32);
plot(y)
title('Pixel (32,32) time course')

