Problem in drawing 3D graph in Matlab - Programmers Heaven

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

#### Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

# Problem in drawing 3D graph in Matlab

Posts: 12Member
Hi, I'm facing problem in plotting a 3D graph in Matlab. I'm not using the meshgrid or similar function because the range of x and y need to be specified specially(Please refer attachment for details).
Thanks for any reply from u..

• Posts: 217Member
Have you tried the function [u]plot3[/u]?
• Posts: 12Member
ya, I had used plot3 in the same program. plot3 is used for 3D line. But what I need is a 3D surface graph specified in a special range of x and y.
I need to draw a 3D grpah of the exact solution, then use plot3 to show the numerical solution( few points) on the 3D graph.
• Posts: 217Member
can't you use the [u]surf[/u] function and then modify the axes properties with the function [u]set[/u]?
• Posts: 12Member
Can you give me some examples? My problem involved the polar coordinate. suppose it is used [u]polar[/u] function in Maple,but in Matlab, I can't understand the [u]polar[/u] funtion, so I don't know how to apply the function into my project.
• Posts: 12Member
Did anyone know about cart2pol function in Matlab?
[THETA,RHO] = cart2pol(X,Y)
It means change the cartesian coordinates [italic]x[/italic] and [italic]y[/italic] to polar coordinates. Before applying this method, I think there should be a list of [italic]x[/italic] and [italic]y[/italic] coordinate in the system in order to change it into polar coordinate.
Now, the problem is, if I use meshgrid, the domian is incorrect, it included the coordinate which I do not want (and excluded the coordinate which I want).
Can anyone tell me or teach me how to fix the problem by writting a command code, to specify the range of x and y correctly? Or should I use pol2cart function? change the polar coordinate to cartesian coordinate, then use those cartesian coordinate to plot my graph.
(Please refer to the attachment for a clearer description)
• Posts: 12Member
Dear anyone, I have been using hard-code to fix my problem. Thanks for any help from you.
Thanks.
• Posts: 1Member
Hi,

I have a similar problem as you posted.
Could you tell me how to solve it?
Thanks

Uwen