MATLAB: How to plot a matrix with vector ? 3d plotsimageimagescmeshplot A=[ 1 2 3 ; 4 5 6; 7 8 9]; B=1:3; imagesc(A,B) Best Answer Depending on what you want, one of these will work:A=[ 1 2 3 ; 4 5 6; 7 8 9];B=1:3;figure(1)plot(B, A)gridfigure(2)surf(A)set(gca, 'XTick',B)grid onIf you want a 2D version of the surf plot, add:view(0, 90)after it.Experiment to get the result you want. Related SolutionsMATLAB: How to remove the space between plotted data and the axis (surf) Adding ‘axis tight’ seems to do what you want:plot_data=rand(25,25);surf(plot_data)grid onaxis squareset(gcf,'color','w')view(0, 90)axis tightTo wit: MATLAB: Plot a 6×6 matrix in 3D N=6;[X,Y]=meshgrid(1:N,1:N);surf(X,Y,A);or plot3(),contour() depending what illustration you want. Related QuestionAdjusting of axis XMatrix change affect other matrixHow to seperate overlapping circles
Best Answer