How to use least-square fit and gaussian surface for 3D data?

12 次查看(过去 30 天)
I have followed the mentioned research papers to calculate the heat footprint using gaussian curve fit. (Land surface temperature images are used to calculate the urban heat island and its spatial extent which is called heat footprint.) https://doi.org/10.1016/j.rse.2014.05.005, https://doi.org/10.3390/a8020082, https://doi.org/10.1016/j.apgeog.2021.102496
Unfortunately, none of these authors have any MATLAB file uploaded here that can help me. Also I tried to look for least square planar fit to find the offset of gaussian equation, since I am new on MATLAB, it is getting a little hard to understand which one is correct and how to use all those results.
Also I used the curve fitting tool but it does not have an option to use gaussian for 3D data. Can anybody help me regarding gaussian surface fit for 3D data?
Thank you

回答(1 个)

Matt J
Matt J 2023-12-12
This FEX file will fit a Gaussian with a constant background in any dimension,
  2 个评论
Deepshikha Deo
Deepshikha Deo 2023-12-18
Thank you for the answer.
As I checked this FEX file, there are two data: xdata and zdata which are necessary. Thus I created a 4834x2 double type with the name 'xdata' and 4834x1 double type with the name 'zdata' in the workspace. As I run the code I get error
gaussfitn
Not enough input arguments.
Error in gaussfitn (line 58)
[M,N]=size(xdata);
How should I deal with it?
I have attached the csv file I used to create the two matrix. In this csv the first two columns are of xy coordinates and the third column has zvalues (temperature data).
Thank you
Matt J
Matt J 2023-12-18
编辑:Matt J 2023-12-18
I can't explain it. It runs fine in the online Matlab engine:
[x,y,z]=readvars("JP_LST.csv");
p=gaussfitn([x,y],z)
Local minimum possible. lsqcurvefit stopped because the final change in the sum of squares relative to its initial value is less than the value of the function tolerance.
p = 1×4 cell array
{[21.9097]} {[661.5662]} {2×1 double} {2×2 double}

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Dimensionality Reduction and Feature Extraction 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by