metab_viewer.m
来自「The goal of SPID is to provide the user 」· M 代码 · 共 62 行
M
62 行
clear all
%change the latate bit for different metabilites
strFilename = 'basissets/metabolite_specs_6.7/choline';
%next two lines are for quick switching between invivo and invitro
%conditions
invivo = false;
invitro = true;
%this specifies if the metabolites should be split by "groups"
add_groups = true;
%linewidth para
damping = 5;
%this is the value ppm of 0hz (middle of the spectra)
ref = 4.7;
if invivo
f_strength = 1.5;
fs = 1000;
tau = 0.0;
N = 1024;
end
if invitro
%this is set for 600Mhz now (at 500 MHz, it would be 11.74 T)
f_strength = 14.1;
%this is the sampling frequency
fs = 7183.9; %600 MHz --- 6009.61538; at 500 MHz
%this is the spin echo time in seconds
tau = 0.0;
%number of complex points
N = 2048;
end
%**************************************************************************
transmitterfreq=f_strength*267.522*10^6/(2*pi);
dt = 1 / fs;
t = (0:dt:(N-1)*dt);
bandwidth=fs;
f_ref=ref*transmitterfreq/10^6;
freq_scale=(-bandwidth/2:bandwidth/(N):bandwidth/2-bandwidth/(N));
ppm_scale=-(-f_ref/(transmitterfreq/10^6)+freq_scale/(transmitterfreq/10^6));
metab_mat = metab_synth(strFilename, fs, transmitterfreq, ref, tau);
groups = max(metab_mat(:,1));
for n = 1:groups
amplitudes = metab_mat(find(metab_mat(:,1) == n),2);
frequencies = metab_mat(find(metab_mat(:,1) == n),3);
sig_group(:,n) = exp(t.'*(-damping.'+j*2*pi*frequencies.'))*amplitudes;
end
if add_groups
sig_group=sum(sig_group,2);
end
%sig_group(1:10)=0;
freq_sig=fftshift(fft(sig_group));
hold all on
plot(ppm_scale,real(freq_sig));
hold all off
set(gca,'xDir','reverse');
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?