How to fit a sigmoid with an input array?

2 visualizzazioni (ultimi 30 giorni)
Atanu
Atanu il 7 Lug 2023
Risposto: Prathamesh il 17 Lug 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.

Risposte (1)

Prathamesh
Prathamesh il 17 Lug 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.

Categorie

Scopri di più su Linear and Nonlinear Regression in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by