Fraser Suzuki Function written in MATLAB

I am trying to write a piece of code which will simulate a Fraser Suzuki function, which is an asymmetrically skewed Gaussian. There are a multitude of papers citing the equation, but I cannot seem to get it working in MATLAB.
I've attached an image of the function above. In the paper they also perform a parameter test on the function to make sure they get the desired peak shape. An example I've attached below.
When I write this function myself the
T-p/w
section of the code goes negative, causing the log function to give imaginary values. As this function has been cited multiple times in literature it seems that it's not the function itself that's wrong but my interpenetration in the code. I've attached the code I've been using the simulate the function.
%%FSuzuki
T = linspace(450,700,1000);
h = 0.005;
p = 600;
w = 40;
s = -0.3;
arg1 = log(2*s*T-p/w+1).^2;
y = h*exp(-log(2)/(s^2)*arg1);
Any help would be greatly appreciated.

1 comentario

Joseph Cheng
Joseph Cheng el 15 de Mayo de 2015
well first of all your matrix operation for arg1 is off. it should be 2*s*(T-p)/w+1. which doesn't solve the issue but should be corrected.

Iniciar sesión para comentar.

 Respuesta aceptada

Joseph Cheng
Joseph Cheng el 15 de Mayo de 2015
Alright, found the paper you mentioned and plotted it in different programs. So... What is happening is that the authors of the paper are ignoring the complex solutions for their Fraser Susuki equation. such that if i re-write your code to be
T = linspace(450,700,1000);
h = [0.005 0.0075 0.01 0.0125 0.015]';
figure(1),hold on
for ind = 1:numel(h)
p = 600;
w = 40;
s = -.3;
lntpw = log(1+2*s*(T-p)/w).^2;
FS = h(ind)*exp(-log(2)/s^2*lntpw);
FS(FS~=real(FS))=0;
plot(T,FS)
end
you get the same curves that they have in the paper.

9 comentarios

Slightly more favoured would be the test
FS(imag(FS)~=0) = 0;
Joseph Cheng
Joseph Cheng el 16 de Mayo de 2015
is there much difference? I like your suggestion better but is it due to computation or possible cases where it would fail?
Christian Reece
Christian Reece el 16 de Mayo de 2015
Thank you very much, this works perfectly. So it was simply just ignoring the complex solutions for the equation?
Joseph Cheng
Joseph Cheng el 17 de Mayo de 2015
that and correcting your order of operations to actually match the equation in the paper.
Blanca Castells
Blanca Castells el 21 de Mayo de 2020
Hello,
I found this quite interesting, so I've tryied do deconvolute my curve using FS. However, when using curve fitting tool box (using custom equation of FS with 3 terms), I couldn't avoid the complex numbers. Any idea how to proceed?
Thanks
My code right now is:
ft=fittype('h1*exp((-log(2)*(log(1 + (2*s1*(x - p1)/w1)))/s1)^2) + h2*exp((-log(2)*(log(1 + (2*s2*(x - p2)/w2)))/s2)^2) + h3*exp((-log(2)*(log(1 + (2*s3*(x - p3)/w3)))/s3)^2);');
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Algorithm = 'Levenberg-Marquardt';
opts.Display = 'Off';
opts.Lower = [0 0 0 100 100 100 0 0 0 0 0 0];
opts.Robust = 'Bisquare';
opts.StartPoint = [0.038 252 0.2 43 0.031 340 0.55 103 0.023 360 0.36 89];
opts.Upper = [0.15 0.15 0.15 700 700 700 1 1 1 700 700 700];
[gfit,gof]=fit(T,alpha,ft,opts);
Rocio Bayon Cabeza
Rocio Bayon Cabeza el 31 de Jul. de 2020
Hi Blanca!
are you still working on this subject?
I think I can help you with the problem of complex numbers
please let me know
Rocio Bayon
Chuan Ma
Chuan Ma el 6 de Oct. de 2020
Hello,
Racio,
Can you tell me how to avoid the complex numbers?
Thank you.
Chuan
Junmeng Cai
Junmeng Cai el 12 de Abr. de 2021
Dear Joseph Cheng, thank you very much!
Great!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Distribution Plots en Centro de ayuda y File Exchange.

Preguntada:

el 15 de Mayo de 2015

Comentada:

el 12 de Abr. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by