Multiple gassian fits in same plot
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Legend dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!