怎么将一个二维高斯转换为两个一维高斯 用matlab怎么实现
1条回答 默认 最新
- weixin_38739225 2020-04-23 20:49关注
function [fitresult, gof] = createFit(x, y)
[xData, yData] = prepareCurveData( x, y); % Set up fittype and options.
ft = fittype( 'gauss1' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.Lower = [-Inf -Inf 0];
opts.StartPoint = [y(ceil(length(x)/2)) x(ceil(length(x)/2)) 0.1]; % Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts ); % Plot fit with data.
h = plot( fitresult, xData, yData);
xlabel( 'β' );
ylabel( 'R' );
legend off
grid on;hold on;
plot(fitresult.b1,fitresult.a1,'^','markersize',6)
运行它,然后在命令行窗口输入:createFit(x,y)解决 2无用 4