Why gridfit is undifined for Matlab 2017b?
6 次查看(过去 30 天)
显示 更早的评论
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'))
0 个评论
采纳的回答
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
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
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 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!