% Define some constants
alpha=pi/2; % 180° saturation pulse [rad]
gamma=40.05; % 19F gyromagnetic ratio in [Hz/µT]
B1_max=25; % Max B1 amplitude in [µT]h
B0=3; % B0 in [T]
t_RF=(alpha*pi)/(2*2*pi*gamma*1e6*B1_max*1e-6)%1e6*alpha/(2*pi*gamma*B1_max); % Shortest RF pulse duration in [µs]
w_RF=2*pi*gamma*B0*1e6; % RF pulse carrier frequence in [rad/s]
t=linspace(0,t_RF,1000000); % Time vector [µs]
B1=B1_max*sin(pi*t/t_RF).*exp(-i*w_RF*t); % B1 pulse
% NOTE: The complete solution must be written out for full credit. This
% code just helps calculate some values...
% Plot the components of the resultant B1 pulse amplitude in the laboratory
% frame as a function of time.
figure; hold on;
plot(t,real(B1),'r','linewidth',1.5);
plot(t,imag(B1),'b','linewidth',1.5);
axis([0 0.001 -30 30]);
xlabel('Time [s]');
ylabel('B1 Amplitude [µT]');
title('90-deg 19F B1-Pulse @ 25µT');
set(gcf,'Color','w');
set(gca,'Color','w','XColor','k','YColor','k');
set(gca,'Color','w','XColor','k','YColor','k','LineWidth',1.25,'Fontsize',11,'Fontweight','bold');
set(get(gca,'Title'),'Color','k','FontSize',16);
set(get(gca,'Xlabel'),'FontSize',14,'fontweight','bold');
set(get(gca,'Ylabel'),'FontSize',14,'fontweight','bold');
grid('on')
print2desktop('/Users/pmagrath/desktop/','HW1_P4_19F_1B')
figure; hold on;
plot(t,real(B1),'r','linewidth',1.5);
plot(t,imag(B1),'b','linewidth',1.5);
axis([.0003 0.0003005 -16 16]);
xlabel('Time [s]');
ylabel('B1 Amplitude [µT]');
%title('90-deg 1H B1-Pulse @ 25µT');
legend('Real','Imaginary')
title('90-deg 19F B1-Pulse @ 25µT');
set(gcf,'Color','w');
set(gca,'Color','w','XColor','k','YColor','k');
set(gca,'Color','w','XColor','k','YColor','k','LineWidth',1.25,'Fontsize',11,'Fontweight','bold');
set(get(gca,'Title'),'Color','k','FontSize',16);
set(get(gca,'Xlabel'),'FontSize',14,'fontweight','bold');
set(get(gca,'Ylabel'),'FontSize',14,'fontweight','bold');
grid('on')
print2desktop('/Users/pmagrath/desktop/','HW1_P4_19F_2B')