Borrar filtros
Borrar filtros

Why gridfit is undifined for Matlab 2017b?

7 visualizaciones (últimos 30 días)
Nima Izadyar
Nima Izadyar el 29 de Ag. de 2019
Editada: Walter Roberson el 20 de Oct. de 2022
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'))

Respuesta aceptada

Walter Roberson
Walter Roberson el 29 de Ag. de 2019
Editada: Walter Roberson el 20 de Oct. de 2022
gridfit is not a Mathworks function. It is available in the file exchange.
  2 comentarios
John D'Errico
John D'Errico el 29 de Ag. de 2019
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 el 30 de Mzo. de 2021
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!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Computational Geometry 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