MATLAB: How to create a contour plot of nodes, x and y displacements

contourplot

I have a data of three vectors in excel format of nodes, x-displacement and y-displacement. Each column vector is of order 79 X 1 and I want to create a contour plot of this data. Kindly help me.

Best Answer

data = xlsread('myfile.xlsx');
x = unique(data(:,1)) ;
y = unique(data(:,2)) ;
z = data(:,3) ;
% dimensions of the Bathymetry
nx = length(x) ;
ny = length(y) ;
% Frame matrix of grid
Z = reshape(z,[ny,nx]) ;
figure ;contour(x,y,Z) ; % contour plot
figure ;surf(x,y,Z) ; % surface plot