필터 지우기
필터 지우기

An empty figure

조회 수: 1 (최근 30일)
Azza Ahmed
Azza Ahmed 2012년 1월 9일
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
David Young
David Young 2012년 1월 9일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Calendar에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by