필터 지우기
필터 지우기

How to fit a sigmoid with an input array?

조회 수: 5 (최근 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 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