How to applied 2d gaussian function
显示 更早的评论
Hi,
I tried to modifed and applied this function: https://au.mathworks.com/matlabcentral/fileexchange/55033-fit-1d-and-2d-gaussian-to-noisy-data?s_tid=prof_contriblnk by @Manuel A. Diaz
I upload my code and data I don't know why the fit not working and the amplitude not in the center of the gaussain
I hope someone can help.
Thanks,
回答(2 个)
You could try this alternative gaussian fitting routine, and see if you get different results:
4 个评论
Z998567
2021-8-3
Here's what I get,
load gauss
[X,Y]=ndgrid(1:length(imageData));
XY=[X(:),Y(:)];
params=gaussfitn(XY, imageData(:));
[D,A,mu,sig]=deal(params{:});
Zfit= D + A*exp( -0.5 * sum( (sig\(XY.'-mu)).*(XY.'-mu) ));
imageFit=reshape(Zfit,size(imageData));
montage({imageData,imageFit})
caxis(4000*[0.7615 0.8126])
Z998567
2021-8-3
Matt J
2021-8-3
Once you have the fitted parameters, you can plot it any way you wish.
类别
在 帮助中心 和 File Exchange 中查找有关 Image Category Classification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

