フィルターのクリア

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 Center および File ExchangeLegend についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by