Borrar filtros
Borrar filtros

Error using matlab.gra​phics.axis​.Axes/set

6 visualizaciones (últimos 30 días)
MS
MS el 15 de Dic. de 2022
Comentada: Voss el 15 de Dic. de 2022
Do not know the remedy for the below mentioned error.
Error using matlab.graphics.axis.Axes/set
Value must be a 1x2 vector of numeric type in which the second element is greater than the first element or is Inf.
Error in axis>LocSetLimits (line 289)
set(ax,...
Error in axis (line 114)
LocSetLimits(ax(j),cur_arg,names);
Error in peakfit (line 1610)
axis([min(xx) max(xx) 0 uyy]);
%% Inputs
i=0;
for fna= 2506 %2506:2520
fname=sprintf('HB2B_%d.h5',fna);
i=i+1;
NumPeaks=1;
NumTrials=15;%the higher the number, the better the fit is (but slower), typical value: 10
BaselineMode=1;%0 no baseline, 1 linear, 2 quadratic, 3 flat(not working yet)
peakshape=33;%Ps. Voigt
window=8e-12;% center +/- (window/2) corresponds to the fitting window
center=1.09e-10;
fwhm=1; start=[center fwhm];%first guess (ignore=0)
fixedparameters=[peakshape start(1) start(2)];%specifies fixed peakshape, pos, width (ignore=0)
plots=1;%plot for each peakfit
extra=1;%all peaks with same shape: use extra=1
%% Code starts
info = h5info(fname);
theta2 = h5read(fname,sprintf('%s/2theta',info.Groups(5).Name));
counts = h5read(fname,sprintf('%s/main',info.Groups(5).Name));
wave=h5read(fname,'/instrument/monochromator setting/wave length')*1e-10;
d=wave./(2.*sin(theta2./2*pi/180));
signal=[d,counts];%d-spacing
%%%%% Error in the bottom line %%%%%
[results,resultserr]=peakfit(signal,center,window,NumPeaks,peakshape,extra, NumTrials, start, BaselineMode,fixedparameters,plots);
%%%%%% Error%%%%%%%%%%%%%%
pos(i)=results(1,2); int(i)=results(1,3);
w(i)=results(1,4); area(i)=results(1,5);
err(i)=resultserr(1); r2(i)=resultserr(2);
end

Respuesta aceptada

Voss
Voss el 15 de Dic. de 2022
Editada: Voss el 15 de Dic. de 2022
First, thank you for including data and runnable code.
Second, it appears to run fine here (see below).
Try updating your peakfit.m by downloading the latest version (it's attached to this answer too):
I just downloaded that, and I notice its line 1610 is not the same as the line 1610 reported in your error message, so probably getting the latest version will fix the problem.
unzip('HB2B_2506.zip')
%% Inputs
i=0;
for fna= 2506 %2506:2520
fname=sprintf('HB2B_%d.h5',fna);
i=i+1;
NumPeaks=1;
NumTrials=15;%the higher the number, the better the fit is (but slower), typical value: 10
BaselineMode=1;%0 no baseline, 1 linear, 2 quadratic, 3 flat(not working yet)
peakshape=33;%Ps. Voigt
window=8e-12;% center +/- (window/2) corresponds to the fitting window
center=1.09e-10;
fwhm=1; start=[center fwhm];%first guess (ignore=0)
fixedparameters=[peakshape start(1) start(2)];%specifies fixed peakshape, pos, width (ignore=0)
plots=1;%plot for each peakfit
extra=1;%all peaks with same shape: use extra=1
%% Code starts
info = h5info(fname);
theta2 = h5read(fname,sprintf('%s/2theta',info.Groups(5).Name));
counts = h5read(fname,sprintf('%s/main',info.Groups(5).Name));
wave=h5read(fname,'/instrument/monochromator setting/wave length')*1e-10;
d=wave./(2.*sin(theta2./2*pi/180));
signal=[d,counts];%d-spacing
%%%%% Error in the bottom line %%%%%
[results,resultserr]=peakfit(signal,center,window,NumPeaks,peakshape,extra, NumTrials, start, BaselineMode,fixedparameters,plots);
%%%%%% Error%%%%%%%%%%%%%%
pos(i)=results(1,2); int(i)=results(1,3);
w(i)=results(1,4); area(i)=results(1,5);
err(i)=resultserr(1); r2(i)=resultserr(2);
end
X-axis flipped.
  2 comentarios
MS
MS el 15 de Dic. de 2022
Thank you. The code ran with new version.
Voss
Voss el 15 de Dic. de 2022
You're welcome!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by