Error in variogramfit.m function use

I would like to ask a question about a code. Especially for the use of variogramfit.m function [fits different theoretical variograms to an experimental variogram].
I would like to vreate a semivariogram My data are 3 columns of a file (x,y,z) . I ve tried the folllowing
clc
clear
filename1= 'C:\Users\hp\Desktop\test.csv'; %input
[d1,tex]= xlsread(filename1);
y=d1(:,3);
x=d1(:,4);
z=d1(:,5);
figure(5)
variogramfit(x,y,z)
a0 = 15; % initial value: range
c0 = 0.1; % initial value: sill
h=d2.val
gammaexp=d.val;
[a,c,n] = variogramfit(h,gammaexp,a0,c0,[],...
'solver','fminsearchbnd',...
'nugget',0,...
'plotit',true);
but command window shows me :
Error using horzcat
Dimensions of arrays being concatenated are not consistent.
Error in variogramfit (line 232)
b0 = [a0 c0 params.nugget];
Error in MYCODE (line 12)
variogramfit(x,y,z)
Could you please help me?

6 件のコメント

Jiri Hajek
Jiri Hajek 2022 年 10 月 20 日
Your inputs to the variografit function seem to provoke an error. Since the function is not part of MATLAB distribution, but probably downloaded code from File Exchange, you can easily debug your problem by placing a breakpoint inside that function, to the line causing the error. There, you will be able to see the cause of the error, by looking at the values of data used on that line.
Ivan Mich
Ivan Mich 2022 年 10 月 20 日
編集済み: Ivan Mich 2022 年 10 月 24 日
Excuse me, but I did not understand you. I am importing the variogramfit.m function.
(https://www.mathworks.com/matlabcentral/fileexchange/25948-variogramfit)
Could you please expain me more analytically? Thanking you in advance.
Torsten
Torsten 2022 年 10 月 24 日
編集済み: Torsten 2022 年 10 月 24 日
You have 2D data - as far as I can see, variogramfit only fits 1D data.
Ivan Mich
Ivan Mich 2022 年 10 月 25 日
I am using the following codes
figure(5)
a0 = 15; % initial value: range
c0 = 0.1; % initial value: sill
h=d.distance; %lag distance
gammaexp=d.val; %?(h)
[a,c,n] = variogramfit(h,gammaexp,a0,c0)
but command window shows me:
Error using fplot (line 84)
Range value must be an increasing real finite 2 element row vector.
Error in variogramfit (line 393)
fplot(@(h) funnugget(b) + b(2),[b(1) max(h)])
could you please help me to separate it?
jerry Lu
jerry Lu 2023 年 11 月 10 日
do you solved this problem, i meet see problem:
Error using fplot (line 84)
Range value must be an increasing real finite 2 element row vector.
Error in variogramfit (line 393)
fplot(@(h) funnugget(b) + b(2),[b(1) max(h)])
Mathieu NOE
Mathieu NOE 2023 年 11 月 10 日
there is no error in the function
as already mentionned by @Torsten variogramfit only fits 1D data.
maybe you can do multiple variogramfit on data slices (in the XY or XZ plane for example)

サインインしてコメントする。

回答 (0 件)

カテゴリ

質問済み:

2022 年 10 月 20 日

コメント済み:

2023 年 11 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by