%tic clear t = 160; L=0.2; NN=150; % x(1:NN)=0; % for I=1:NN/2, % x(I)=sin(2*I*pi/(NN)); % end for I=1:NN, x(I)=(sin(I/2))*exp(-(I-75)^2/300); end options = odeset('RelTol',1e-7,'OutputFcn','odeplot','OutputSel',[1]); [t x] = ode45('complexbloch1', [0:L:t], x, options); for I=1:NN, q(:,I)=real(x(:,I)).^2+imag(x(:,I)).^2; end