Specifying a position of a Gaussian fit
Show older comments
Please how can I specify where my gaussian should be fitted on a data plot
Below is my matlab code and attahed are my sample plot with the data.
clear; clc;
thisfile = pwd + "\matlabdata.txt\";
Txtdata = load(thisfile);
x = Txtdata(:, 1);
y = Txtdata(:, 2);
inc=~isnan(y);
hgt = find(isnan(y));
gEqn = 'a*exp(-((x-b)/c)^2)+d';
startPoints = [5 0 10 2];
[fj,gof,output] = fit(x,y,gEqn,'Start', startPoints, 'Exclude', hgt);%,'Start', startPoints, 'Exclude', [1 10 25]
plot(fj,x,y)

The blue line is anexample of my desired Gaussian.
Its more of shifting a little bit the centre of the Gaussian side ways. I do not know if its possible
Thanks
1 Comment
Mathieu NOE
on 22 Dec 2022
Seems to me you want to "shape" your gaussian curve , not simply shift it
you have to first define which model would better fullfill your task
Accepted Answer
More Answers (0)
Categories
Find more on Interpolation of 2-D Selections in 3-D Grids in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
