Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

3D plot problem in MATLAB

Status
Not open for further replies.

project.email

Member level 4
Joined
May 25, 2007
Messages
77
Helped
8
Reputation
16
Reaction score
8
Trophy points
1,288
Activity points
1,845
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?

x=data:),1);
y=data:),2);
SAR=data:),4);
[X,Y,sar]=meshgrid(x,y,SAR);
surf(X,T,sar);

??? Maximum variable size allowed by the program is exceeded.

Error in ==> meshgrid at 60
xx = xx(ones(ny,1),:,ones(nz,1));
 

Attachments

  • SAR.txt
    419.3 KB · Views: 98

A similar problem

h**p://www.mathworks.com/matlabcentral/newsreader/view_thread/136000
 

Hi;
Do you really need 'surf'? I think you just want a skecty diagram of SAR parameter against x&y in 3D rigth?
just try this;
plot3(x,y,SAR,'.')
 

Dear blooz

it was just the problem not the solution.
I think the Problem is with no of elements too large to handle ...

probably this can give you a better idea

h**p://www.mathworks.in/support/tech-notes/1100/1106.html#1



h**p://www.mathworks.in/support/tech-notes/1100/1107.html



Emresels ....Suggestion Works Perfect

Works_Perfect.jpg
 
Last edited:

dear Emresel and blooz
thanks for your reply

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.

Error in ==> meshgrid at 45
yy = yy:),ones(1, nx));
 

it is really interesting!!!:-D

I bounded my x and y data members as following:

x=x(1:600);
y=y(1:600);
SAR=SAR(1:600);
[X,Y]=meshgrid(x,y);
sar=meshgrid(SAR);
saurf(X,Y,sar);
shading interp;
and the following plot is obtained.
SAR_Dis.png

I realy don't know why this happened!
I slept and try this program another today(I mean I turn off my PC)

Dose it affect the performance of memory?(I mean turnnig off the PC after long time working!)
 

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.
x_y.png

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

See resulting plots.
raw data.GIFcurve fit.GIF
 
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?
 
this problem have not solution lol!
 

Hi project.email;
Yes you are right.
First check MATLAB examples carefully and tyr to understand.
Good luck.
 

Hi project.email;
Yes you are right.
First check MATLAB examples carefully and tyr to understand.
Good luck.

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.
86_1326822660.png


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?
curve fit.GIF
 

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:cry:

PS: If you find out any solution let me know.
Good luck
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top