How to fit a sigmoid with an input array?

12 visualizaciones (últimos 30 días)
Struggling in MATLAB
Struggling in MATLAB el 7 de Jul. de 2023
Respondida: Prathamesh el 17 de Jul. de 2023
I have a table which have 3 columns, 'fsiIndex', 'plsIndex', and 'striosomeIndex'. The goal is to plot each index against each other and get the fitting parameters for each row. I have plotted 'plsIndex' vs 'fsiIndex' and obtained parameters (a and b) for each row and saved them in a column. I also have X and Y arrays for plots between PLS vs FSI as 'plsFsi_dat_x' and 'plsFsi_dat_y', respectively. Now I have to plot 'fsiIndex' vs 'striosomeIndex' with a fit equation
fitType = @(c, plsArray, x) 1./(1 + exp(c - plsArray./x));
Where plsArray is an array of double.
plsArray = fsiPlsStrioTriplets.plsFsi_dat_x{row};
I have done fitting before with
fitType = @(c, x) 1./(1 + exp(c - 1./x));
[fitresult, gof] = fit(fsiArray, striosomeArray, fitType, 'Startpoint', [1, 1]);
But I am not sure how to implement fitType of first kind. I have attached the mat file for reference. I'd appreciate any input on this.

Respuestas (1)

Prathamesh
Prathamesh el 17 de Jul. de 2023
Hi,
I understand that you implemented fittype with two inputs 'c' and 'x' and you are facing an issue with providing stream input 'plsArray'. You can use fit function itself in order to plot ‘fsiIndex’ and ‘striosomeIndex’ with the custom fit function in the following way:
plsArray = fsiPlsStrioTriplets.plsFsi_dat_x;
c = 10;
fitType = @(c, plsArray, x) 1./(1 + exp(c - plsArray./x));
[fitresult, gof] = fit(fsiPlsStrioTriplets.fsiIndex, fsiPlsStrioTriplets.striosomeIndex, fitType, 'Startpoint', [1, 1]);
plot(fitresult);
Please refer to the following document for more information:
I hope this resolves your query.

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by