dear all
I want to plot a 3D Data in the attached file.
first, I import the txt file in matlab it has 4 column the first column is x axis the second column is y axis the third is z axis data (I mean the position) and finally the last column is the desired value in 3D coordinate.
after importing the txt file in matlab I used this command and faced the following error
how can I solve it?
I just want 3D surface graph of this data
it's right that the plot3 command approximately plot this result correctly,but I really need the surf plot of this data.
I tried the following command but another error achived:
x=data,1);
y=data,2);
SAR=data,4);
[X,Y]=meshgrid(x,y);
??? Out of memory. Type HELP MEMORY for your options.
Hi;
I think this not plot of your real data (if you look carefully, there are many surfaces in the graph)
as i know meshgrid is used to convert your x and y vector into a matrix like a grid (to evalute your function all over the grid), and then plot in 3D.
But as seen from the plot ("plot(x,y,'.')") your input space is already as grid.
You can use following code to cover a surface to the output of "plot3".
Code:
tri=delaunay(x,y);
trisurf(tri,x,y,SAR)
shading interp
title('plot via raw nonuniform data')
%here a uniform input grid is created and a surface is fitted similiar to your actual surface
xlin=linspace(min(x),max(x),500);
ylin=linspace(min(y),max(y),500);
[X,Y]=meshgrid(xlin,ylin);
fit_SAR=griddata(x,y,SAR,X,Y);
figure
surf(X,Y,fit_SAR)
title('plot via uniform data and curve fitting')
shading interp
dear Emresel
Thanks for your kindly reply
You are absolutely right
so,I think I should be familiar with "trisurf" and "griddata" functions
I think these are two important function to plot this 3D-plot correctly.
i.e, without them I can't plot the figure correctly.
Am I right?
Dear emresel
It's me again :wink:
sorry,I tried to understand your useful code I exactly want an smooth surface something like the attached Figure.
I used the this command but the result didn't change it's shape to the smoother one.
so I used this code to get the smoother surface
Code:
fit_SAR=griddata(x,y,SAR,X,Y,'cubic');
but it hadn't any effect. so, how can I plot the more smooth surface than your figures?
Hi;
Is that attached figure plotted from your SAR.txt data file or another example?
I think, it is not possible to plot like that, because your data space doesn't contain details enough.
Maybe you need more precisely sampled data space.
It is out of experince sorry
PS: If you find out any solution let me know.
Good luck