Pages

Saturday, November 12, 2011

Plotting data in matlab


So, I had corrosion data by locations (latitudes and longitudes). I wanted to produce a graph.

So, I had this data array (showing only first three rows):
-82.993 42.293 12
-82.361 42.985 10.3
-82.993 42.293 7.4


>> x = transpose(data(:,1));
>> y = transpose(data(:,2));
>> z= transpose(data(:,3));
>> x_edge=[floor(min(x)):0.1:ceil(max(x))];
>> y_edge=[floor(min(y)):0.1:ceil(max(y))];
>> [X,Y]=meshgrid(x_edge,y_edge);
>> Z=griddata(x,y,z,X,Y);
>> surf(X,Y,Z);


>> Z=griddata(x,y,z,X,Y);

No comments:

Post a Comment