⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 createdb.m

📁 The goal of SPID is to provide the user with tools capable to simulate, preprocess, process and clas
💻 M
字号:
clear all
close all

%% initialization 
% parameters for creating a 600MHz - 14.1 T HRMAS database 
step = 0.1392;
frequency = 600130;
begin = 0;
ndp = 2048;

fs = 7183.9;
transmitterfreq = 600.13E6;
ref = 4.7;
tau = 0;
deltaf = [0];
filename = 'DB600MHz';
save(filename,'step','frequency','ndp','begin')

%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

% %% initialization 
% % parameters for creating a 500MHz - 11.4 T HRMAS database 
% step = 0.1666;
% frequency = 500130;
% begin = 0;
% ndp = 2048;
% 
% fs = 6009.61538;
% transmitterfreq = 500.13E6;
% ref = 4.7;
% tau = 0;
% deltaf = [0];
% filename = 'DB500MHz';
% save(filename,'step','frequency','ndp','begin')
% 
% %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 = 11.4;
%     %this is the sampling frequency
%     fs = 6009.61538; %at 500 MHz
%     %this is the spin echo time in seconds
%     tau = 0.0;
%     %number of complex points
%     N = 2048;
% end


metlist = {'acetate', 'alanine','aspartate','choline','creatine','glycero-phosphocholine_b',...
    'glucoseAlpha','glucoseBeta','glutamate', 'glutamine','glycine','lactate', 'myo-inositol',...
    'NAA','phosphorylcholine','phosphocreatine','succinate','taurine'};
%**************************************************************************
%% Running Program
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));


for i = 1:length(metlist)
    strFilename = fullfile('basissets','metabolite_specs_6.7',[char(metlist(i)),'.xls']);
    v = genvarname(char(metlist(i)));
    eval([v ' = metab_synth(strFilename, fs, transmitterfreq, ref, tau);']);
    eval(['vt =' v ';']);
    groups = max(vt(:,1));
for n = 1:groups
    amplitudes = vt(find(vt(:,1) == n),2);
    frequencies = vt(find(vt(:,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
eval([v '= sig_group'';'])
%sig_group(1:10)=0;
    eval(['save ',filename, ' ',v,' -append'])  
end



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -