Filter löschen
Filter löschen

I want to create the surface plot by surface command for my sets of data.

2 Ansichten (letzte 30 Tage)
In my data there is temperature in one column,speed in one column and modulus of elasticity in one column.I would like to take temperature as X and Speed as Y and Modulus of elasticity as Z.I am trying to use the surface command but it is showing error such as 'Data dimension must agree',I am attaching the script please find the attachment.
  3 Kommentare
Prateek Srivastava
Prateek Srivastava am 21 Apr. 2018
yes actually we cannot attach xlsx when we are asking the question in matlab so that is the reason I have attached the xls file.
Walter Roberson
Walter Roberson am 21 Apr. 2018
You can zip any kind of file and attach the .zip

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 21 Apr. 2018

You have scattered data; it is not possible to surface() it.

N = 20;
mins = min(A); maxs = max(A);
[Temperature, Speed] = ndgrid(linspace(mins(1),maxs(1),N), linspace(mins(2),maxs(2),N));
F = scatteredInterpolant(A(:,1),A(:,2),A(:,3));
vq = F(Temperature,Speed);
surf(Temperature, Speed, vq);
  9 Kommentare
Prateek Srivastava
Prateek Srivastava am 24 Apr. 2018
but could I get some kind of equation from these results so that I could put some kind of constant value and optimize the process for further use,some kind of formulation for this kind of function.
Walter Roberson
Walter Roberson am 25 Apr. 2018
No, scatteredInterpolant cannot return equations.
You could in theory replicate the functionality by using a Delaunay triangulation to divide the surface up into triangles according to which points are closest. That done, you could go through and construct a table of linear constraints that define the boundaries of each of the triangles, along with the triangular interpolation coefficients that are relevant to the interior of that triangle. That done, if you have the Symbolic Toolbox, you could construct a big piecewise() -- if the x, y have this relationship then this calculation, if the x, y have this other relationship then this other calculation, and so on.
You will likely find that in practice, optimization over such a piecewise equation does not work very well.
But I suspect that what you are really looking for is a single non-piecewise surface equation generated out of the known points. If so, then the answer is that given any finite number of points specified to finite precision, and corresponding result values, that there are an infinite number of surface equations that fit the points exactly (to within round-off).
This is the infinity of continuous numbers, the uncountable infinity, not the mere countable infinity, so it turns out that allowing for the possibility that the measurements might not be exact (noise in the system or imprecision in the readings) does not increase the number of potential solutions, since as far as we can tell there is no "larger" infinity except as pure abstractions.
When there are an infinite number of possible functions that all fit the known data exactly (to round-off) then the probability that any given function is the "real" function for the system is precisely zero.
The situation is extremely different if you know the form of the function and are just missing the values of the coefficients. You do not have enough data to fit anything more complicated than a cubic in one of your variables with a quadratic in the other (total power 6), and it should be obvious from the surface plot that a surface that simple is not an adequate explanation for the surface you are getting. But it is possible, you can fit up to 6 degrees of freedom with 7 data points, if you know the form of the equation.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Interpolation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by