Multiple gassian fits in same plot

조회 수: 2 (최근 30일)
Fc Fc
Fc Fc 2018년 2월 9일
편집: Fc Fc 2018년 2월 9일
Hi everyone, I need to fit a data set using a single and double gaussian fit. I wrote:
global fitresults
.
.
.
fitresults={}
.
.
.
eVcIpicco=eVc(:,1:20);
ckxfitIpicco=ckxfit(:,1:20);
[myfitga1,god1]= fit(eVcIpicco.',ckxfitIpicco.','gauss1');
[myfitga2,god2]= fit(eVcIpicco.',ckxfitIpicco.','gauss2');
fitresults{1}=myfitga1;
fitresults{2}=myfitga2;
figure (5)
plot5=figure (5);
set(plot5, 'Visible', 'off');
hold on;
h1=plot((fitresults{1}),'r-',eVcIpicco,ckxfitIpicco,'bo');
h2= plot( (fitresults{1}), 'r-' );
h3=plot((fitresults{2}),'g-');
xlabel('Energia (eV)');
ylabel('Conteggi relativi');
legend( [h1 h3], 'Dati', 'Gaussian 1 fit', 'Gaussian 2 fit');
title('Fit gaussiano primo picco');
axis([282 288 0 0.06]);
hold off;
But I get this error:
Error using horzcat
Dimensions of matrices being concatenated are not consistent.
Error in sp2sp3diff_Titantah (line 361)
legend( [h1 h3], 'Dati', 'Gaussian 1 fit', 'Gaussian 2 fit');
If I don't write the line
legend( [h1 h3], 'Dati', 'Gaussian 1 fit', 'Gaussian 2 fit');
I'get the plot but the legend isn't good and I cant' customize it, as you can see by the plot
Can somebody help me? Thanks

답변 (0개)

카테고리

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