How to fit a sigmoid with an input array?

2 ビュー (過去 30 日間)
Atanu
Atanu 2023 年 7 月 7 日
回答済み: Prathamesh 2023 年 7 月 17 日
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 Center および File ExchangeLinear 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