% Bloch Equation Simulation, Excercise B-5b
% -----------------------------------------
% 

df = 0;		% Hz off-resonance.
T1 = 600;	% ms.
T2 = 100;	% ms.
TE = 2;		% ms.
TR = 10;
flip = [0:0.01:0.5 ]*pi;	% radians.
inc = 117/180*pi;
Nex = 100;


for k=1:length(flip)
	sig1(k)=spgrsignal(flip(k),T1,T2,TE,TR,df,Nex,inc);
	[Msig,M]=srsignal(flip(k),T1,T2,TE,TR,df);
	sig2(k)=M(1)+i*M(2);
end;


% ===== Plot the Results ======

plot(flip,abs(sig1),'r-',flip,abs(sig2),'b--');
xlabel('Flip (rad)');
ylabel('Signal Magnitude');
grid on;
title('Signal vs Flip for RF-spoiled GRE and SR');
legend('RF-spoiled GRE','Saturation-Recovery Approximation');

		







