How to fit a sigmoid with an input array?

2 次查看(过去 30 天)
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.

回答(1 个)

Prathamesh
Prathamesh 2023-7-17
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.

类别

Help CenterFile Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by