An empty figure

2 views (last 30 days)
Azza Ahmed
Azza Ahmed on 9 Jan 2012
Many thanks for getting back to me. I did the necessary changing by having another variable F with the same dimension of the one in the file, but when I tried to plot the figure from the code below, I received an empty figure. I should get a two 2 sin waves (blue and red) and a recovery one (the green). I think its the gradRO is taking only one value inside the loop {because I tried to print it in the command window) but I am not sure why this is happening. Would you kindly help me with this?
clear all T1 = 600; %ms T2 = 300; %ms df = 10; %for off-resonance
dT = 1; % delta time
flip =pi/3; % angle of RF pulse TE = 1; %ms
Gamma = 4256; %Hz/G
TR = 200; %ms.
%
[A,B] = freeprecess(dT,T1,T2,df);
importfile ('allgradients.txt');
Gx = data(:,3);
F = length(Gx); %number of time steps
M = zeros(3,F);
M(:,1) = [0;0;1];
Rflip = yrot(flip);
M(:,2)=A*Rflip*M(:,1)+B;
for r=3:F
M(:,r) = A*M(:,r)+B; %propagation after RF pulse
gradRO = Gamma*pi*2*Gx(F-2)*(dT/1000)*2.9360;
M = zrot(gradRO)*M;
end;
time = [1:F]*dT; plot(time,M(1,:),'b-',time,M(2,:),'r--',time,M(3,:),'g-.'); legend('M_x','M_y','M_z'); xlabel('Time (ms)'); ylabel('Magnetization'); axis([min(time) max(time) -1 1]); grid on;
  1 Comment
David Young
David Young on 9 Jan 2012
This doesn't look like a new question - does it refer to a previous one? If so, please could you update the previous question by editing it, or adding comments as appropriate, as it's confusing to find new questions that are not self-contained.

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!