[code submission]

With the simulation tools of FID-A-master I created simulated spectra of triglycerides observed with PRESS. A Matlab function Sim_UFATG_PRESS.m creates the spin systems for all protons of (poly)(un)saturated fatty acids of variable chain lengths and glycerol to simulate biological triglycerides.
In the package I included a function for plotting simulation output as single spectra or as a stacked plot and a spin system of triglyceride. It also includes a function to sum the outputs of simulations so we can build biological fats or oils with various amounts of unsaturated or saturated fatty acids by summing the simulation outputs.
Unfortunately I can’t attach the software in a .zip format (as per instructions on https://mrshub.org/software_contribute/) because only jpg, jpeg, png, gif, txt, md, pdf are authorized extentions. I hope to learn how I can upload the zip file soon.

Ronald

Dear Ron,

Thank you, that is an awesome submission! I’ve received your e-mail, uploaded your code to the MRSHub GitHub repository, and created an entry in the Software & Code section of the MRSHub.

My sincere apologies that you weren’t able to upload .zip files as attachment to your post - this was a restriction of the forum software that I have now fixed… so please don’t hesitate to try again with your next submission :wink:

Thanks again!
Best wishes,
Georg (on behalf of the MRSHub Team)

Hi @ouwerkerkr,

Would you be able to help out this user who accessed the MRSHub version of your code?

Cheers!
Georg

Hi,
Sorry for this omission. gausmult.m is simply applying a Gaussian line broadening to the signals. See Code below

Ronald

function gsdata = gausmult(data, width, SW, tbegin )
%============================================================================
% function gsdata = gausmult(data, width, SW, tbegin);
% INPUT:
% data = complex time domain data in columns
% [m,n] = size(data) then m is the number of time points and n is the
% number of signals
% width : line broadening in Hz (default 2 Hz)
% SW is spectral width Hz ( default 1500)
% tbegin, tste begin time and step time on s ( default 0 and 1e-3 )
%==========================================================================
[m,n] = size(data);

if nargin < 2
width = 2;
end

if nargin < 3
SW = 1500;
end

if nargin < 4
tbegin = 0;
end

tstep = 1/SW;

% Fourier transform of a Gaussian
% FTexp( -ax^2) = sqrt( pi/a)* exp( -pi^2k^2/a)
% half height in freq domain is when exp( -pi^2
k^2/a) = 0.5
% so ln( 2 ) = pi^2k^2/a, or aln(2)/pi^2 = k^2
% Substittute the desired line width lw for k
% ( lw/2 )^2 = -a*ln(2)/pi^2
% Now a = ( lw/2 pi )^2 /ln(2)
widthsq = (pi
width/2)^2/log(2);
time = (tbegin+(0:m-1)’*tstep);

if n ==1
timesq = time.^2;
gsdata = data.exp(-timesqwidthsq);
else
time = time( :, ones(1,n) );
timesq = time.^2;
gsdata = data.exp(-timesqwidthsq);
end

1 Like

Thanks Ron for getting back so quickly! I just added that function to the repository.