Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Surface fit x y vector data with length(x)*length(y) size Z matrix

1 Ansicht (letzte 30 Tage)
Alessandro Maria Laspina
Alessandro Maria Laspina am 20 Mär. 2021
Geschlossen: John D'Errico am 20 Mär. 2021
Hello,
I am reposting a question to clear some things up from my previous post. Let me introduce the problem again:
I have an x vector and y vector of data, for which I have the results for each row index combination of x and y stored in matrix Z. x and y are the same size and Z is a matrix where the row and column length is the same as the row size of x and y.
I would like to obtain a fit of the following form: (a+b*x+c*x^2)+(d+e*x+f*x^2)*sin(y)+(g+h*x+ii*x^2)*cos(y), where a,b,c,d,e,f,g,h,ii (yes not i;so that imaginary is not overwritten) are the constants. For this, I have the following code:
myfittype = fittype('(a+b*x+c*x^2)+(d+e*x+f*x^2)*sin(y)+(g+h*x+ii*x^2)*cos(y)',...
'dependent',{'Z'},'independent',{'x','y'},...
'coefficients',{'a','b','c','d','e','f','g','h','ii'});
fitCL=fit([x y],Z,myfittype);
This however results in the following error:
Operator '<' is not supported for operands of type 'fittype'.
Error in fit (line 7)
if dim_x < m
  4 Kommentare
Cris LaPierre
Cris LaPierre am 20 Mär. 2021
Save your variables x,y and Z to a mat file and attach it to your post using the paperclip icon.
When I run your code for myfittype, I do not get the error you report. Please share the entire error message (all the red text).
darova
darova am 20 Mär. 2021
Why do you need such complicated formula? Can you attach/show the data?

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by