- The first one being X = x where x is a vector (matrix with a single column).
- The second one is X = [x,y] where x and y are vectors which makes X (the first argument to the fit function), a matrix with two columns.
Queries on [x,y] in the fit function
2 views (last 30 days)
Show older comments
I have a matix where the rows are the x values, columns are the y values and the matrix elements are the z values. I want to try to use the "fit" function in matlab to plot them. (My matrix has 3500 rows and 250 columns)
I have tried reading the documentation of this function. However, I still don't understand the input parameters [x,y],z should look like.
For example: For x it says "Data to fit, specified as a matrix with either one (curve fitting) or two (surface fitting) columns. You can specify variables in a MATLAB table using tablename.varname. Cannot contain Inf or NaN. Only the real parts of complex data are used in the fit." Why should my x have 2 colums? And what should I put for y inin such a case.
If someone could elaborate on how my the input parameters in more detail, I would be really grateful.
0 Comments
Answers (1)
Vinay Konanki
on 22 Jan 2020
Hii Akaash,
Consider the statement below,
fitobject = fit(X,Z,fitType);
You can consider X (or x mentioned in the documentation) as the first argument to the fit function.
There are two acceptable cases.
The first case leads to a curve fit where as the later case leads to a surface fit.
0 Comments
See Also
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!