Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

3D surface plots 2

Status
Not open for further replies.

yaston4

Mechanical
Jan 9, 2012
130
0
0
GB
I am really in need of some help please.

I am new to Matlab and I need to produce a 3D surface plot using the data in excel, can anyone help me. I have posted the excel data. I have plotted the surface plot in excel, but as you can see the surface plot is not very smooth and I believe Matlab can produce a smoother plot.

I don't mind using any other software that might achieve a smoother surface plot.

Thank-you
 
Replies continue below

Recommended for you

Why not do the graph in Matlab?

Please refrain from double posting in the future.

TTFN
faq731-376
7ofakss
 
Thank you IRStuff and I apologise for the repeated post.

I have found a program on MATLAB central, which I think can help me with my problem. I wondered if anyone is having the same problem with it as I am. I open the MainGUI.m in MATLAB and run the code using (F5), but when the GUI pops up non of the GUI buttons seem to offer any commands.


Sorry I am new to Matlab. Thanks.
 
I think you're over-complicating this. Two Google searches and I've arrived at this solution:

1. Select the data (Z) values in Excel and copy them to the clipboard.

2. Enter the following in Matlab.
>> [X, Y] = meshgrid(-16:1:11, 1:1:19);
>> UIIMPORT('-pastespecial')

3. Ensure the data from Excel appears as necessary, then click Next and Finish.

4. Plot the result in Matlab using the following command.
>> surf(X, Y, A_pastespecial)

Is that what you're after?

The surf command has lots of options for changing the appearing. The mesh command might be what you want too. Check out the options here:


There could be more elegant solutions too, but if quick and dirty is what you're after then I think you have it!
 
There are lots of ways to create such a plot. I might fill in the empty cells with zeros and save the XLS file as a CSV file.
From there, you could do:
Code:
DATA = csvread('data1.csv');
x = DATA(2:20,1);
y = DATA(1,2:29);
[xx,yy]=meshgrid(x,y);
zz = DATA(2:20,2:29)';
surf(xx,yy,zz);
grid on; axis equal; colorbar;

 
 http://files.engineering.com/getfile.aspx?folder=d0155fe1-ac59-46fc-bc94-5e15cb2e34ad&file=data1.png
Status
Not open for further replies.
Back
Top