![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/323671/image.png)
fit結果の各項目毎のプロット
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Shuichi Nagamatsu
am 29 Jun. 2020
Beantwortet: Akira Agata
am 29 Jun. 2020
例えばgauss3でフィッティングしたときに
全体のfit結果だけでなく
各項のgaussカーブも表示する方法はありますか?
0 Kommentare
Akzeptierte Antwort
Akira Agata
am 29 Jun. 2020
関数fitが出力するcfitオブジェクトの中には、近似曲線の各係数が保存されていますので、これを使ってそれぞれのgauss曲線を描画することができます。
% Sample data
x = linspace(0,3*pi);
y = sin(x).^2;
% Fit with 3xGaussian
f = fit(x',y','gauss3','Upper',10*ones(1,6));
% Gaussian shape
fnc = @(a,b,c,x) a*exp(-((x-b)./c).^2);
% Visualize the data
figure
subplot(2,1,1)
plot(x,y)
legend('Original')
subplot(2,1,2)
plot(x,fnc(f.a1,f.b1,f.c1,x))
hold on
plot(x,fnc(f.a2,f.b2,f.c2,x))
plot(x,fnc(f.a3,f.b3,f.c3,x))
legend({'Gauss1','Gauss2','Gauss3'})
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/323671/image.png)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 内挿 finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!