help with using surface fit function

3 visualizaciones (últimos 30 días)
Alexander Lazarev
Alexander Lazarev el 2 de Mayo de 2022
Comentada: Alexander Lazarev el 5 de Mayo de 2022
I cant figure out whats wrong - but i just cat get this function to work. I have a 2D array of values (256x256) - z
I define X1 as 1x256 vector
Y1 as 1x256 vector
trying to use this, according to an example from the Help Docs:
sf=fit ( [X1,Y1],z,'Exclude', z < 10)
i get abunch of errors which I cant even understand.
Error using fit>iParseOptionalArgs
Algorithm options must be specified in a FITOPTIONS object or as property-value pairs.
Error in fit (line 113)
[useroptions, useroptargs, probparams] = iParseOptionalArgs( varargin{:} );

Respuesta aceptada

Matt J
Matt J el 2 de Mayo de 2022
Editada: Matt J el 2 de Mayo de 2022
You haven't specified the fit type. Also, your X, Y, and z elements all need to be (256^2)x1 vectors.
[XX,YY]=ndgrid(X1,Y1)
sf=fit ( [XX(:),YY(:)],z(:),fitType, 'Exclude', z < 10)
  7 comentarios
Matt J
Matt J el 2 de Mayo de 2022
Editada: Matt J el 3 de Mayo de 2022
The Exclude option must also be given input in vector form. From the doc:
Exclude Points to exclude from fit
expression | index vector | logical vector | empty
sf=fit ( [XX(:),YY(:)],z(:),fitType, 'Exclude', z(:) < 10)
Alexander Lazarev
Alexander Lazarev el 5 de Mayo de 2022
thank you it finally worked )))

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by