Why gridfit is undifined for Matlab 2017b?

8 ビュー (過去 30 日間)
Nima Izadyar
Nima Izadyar 2019 年 8 月 29 日
編集済み: Walter Roberson 2022 年 10 月 20 日
Hi,
I am trying to run the following code to have uniform input using Matlab R2017b, however, I have received this error 'Undefined function or variable 'grid fit'. I would like to know how I should solve this problem.
Ymin=min(Y); %find minimum Y value
Ymax=max(Y); %find maximum Y value
Ynum=fix((Ymax-Ymin+1)/5); %set number of Y points to use for grid
Hmin=min(H); %find minimum H value
Hmax=max(H); %find maximum H value
Hnum=fix((Hmax-Hmin+1)/5); %set number of H points to use for grid
Ynodes=linspace(Ymin,Ymax,Ynum); %set nodes for the Y direction
Hnodes=linspace(Hmin,Hmax,Hnum); %set nodes for the H direction
[Ygrid,Hgrid]=meshgrid(Ynodes,Hnodes); %create the Y and H grids
[Y,H,z,Ynodes,Hnodes] = gridfit(Y,H,z,Ynodes,Hnodes);
zgrid = [Y,H,z,Ynodes,Hnodes]; %create the zgrid (z for each Y,H)
zgridmin=0; %set the minimum elevation desired
zgridmax=3; %set the maximum elevation desired
[zgridY,zgridH]=size(zgrid); %get the size of the grid
YG = zgridY;
HG = zgridH;
%go through the grid and adjust any points out of desired range
for i=1:YG
for j=1:HG
if zgrid(i,j)<zgridmin
zgrid(i,j)=zgridmin;
end
if zgrid(i,j)>zgridmax
zgrid(i,j)=zgridmax;
end
end
end
L=zgridmax-zgridmin-1;
%create plot with lines at integer values by picking proper number to plot
[C,hh]= contour(Ygrid,Hgrid,zgrid,L);
set(hh,'ShowText','on','TextStep',get(hh,'LevelStep'))

採用された回答

Walter Roberson
Walter Roberson 2019 年 8 月 29 日
編集済み: Walter Roberson 2022 年 10 月 20 日
gridfit is not a Mathworks function. It is available in the file exchange.
  2 件のコメント
John D'Errico
John D'Errico 2019 年 8 月 29 日
As much as I think it SHOULD have been piut into MATLAB in some form, it is not there. But you can always download it again, as you must have done at some point in the past.
Most likely, you still have the code, in some directory that was on your search path for that repvious release. So you just need to update your search path to reflect that.
I always make sure that any downloaded toolboxes (and all of my own toolboxes) get put on the search path when I upgrade a relase. In fact, I even put a code on the file exchange to help you do that.
It allows you to export the current search path of your old release. Then you go into the new release, and then use the import search path tool provided.
yaoxinzheng yaoxinzheng
yaoxinzheng yaoxinzheng 2021 年 3 月 30 日
An error occurred while using the "gridfit" function:
Insufficient data for surface estimation.
What are the possible causes of such errors?
Looking forward to your reply!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by