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

조회 수: 12 (최근 30일)
Deepshikha Deo
Deepshikha Deo 2023년 12월 12일
편집: Matt J 2023년 12월 18일
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에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by