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

surface plot

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.

Best Answer

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);