Plotting a Matrix within an X,Y range

In summary: The problem is that the plotted graph does not correspond to the actual dimensions of the plate. The solution is to use the "mesh" command in MATLAB which allows for a more accurate representation of the temperature profile on the plate.
  • #1
Link-
100
0
Hi guys...

Here's the problem. I want to plot a Temperature T(x,y) profile across a plate with dimensions L x W. I'm using finite difference method so the temperature are only known at the nodes I choose, if I make n nodes across the Length and m nodes across the Width I will end up with an n x m matrix or n*m x 1 matrix. The problem is that I want to assign each known Temperature of the nodes to its respect point in the plate across the x-y plane.

Is not a plotting command problem, I used surf(T) or mesh(T) and I end up with a plot that have the temperature profile but the x-axis goes from 0 to n and the y from 0 to m and not LxW. The temperature is not in it's corresponding x,y point.

Any help?
Thanks in advance.
 
Technology news on Phys.org
  • #2
You need to learn to read the documentation. From MATLAB's help:

mesh(X,Y,Z) draws a wireframe mesh with color determined by Z so color is proportional to surface height. If X and Y are vectors, length(X) = n and length(Y) = m, where [m,n] = size(Z). In this case, (X(j), Y(i), Z(i,j)) are the intersections of the wireframe grid lines; X and Y correspond to the columns and rows of Z, respectively. If X and Y are matrices, (X(i,j), Y(i,j), Z(i,j)) are the intersections of the wireframe grid lines.

- Warren
 
  • #3


I understand your problem and can offer some suggestions to help you plot your matrix within an X,Y range. One option is to use the meshgrid function in MATLAB to create a grid of coordinates that correspond to your desired X,Y range. This will allow you to plot your temperature values at their respective X,Y points on the grid. Another option is to use the pcolor function in MATLAB, which creates a pseudocolor plot and allows you to specify the X,Y coordinates for each data point. Additionally, you may want to consider using a different plotting function that allows you to specify the X,Y coordinates, such as scatter or scatter3. I hope these suggestions help and good luck with your research!
 

1. What is the purpose of plotting a matrix within an X,Y range?

The purpose of plotting a matrix within an X,Y range is to visually represent data points or values in a two-dimensional space. This allows for easier interpretation and analysis of the data.

2. How do I determine the appropriate X,Y range for my matrix plot?

The X,Y range for a matrix plot is determined by the minimum and maximum values of the data being plotted. It should cover all of the data points and provide enough space for the plot to be clearly displayed.

3. Can I change the X,Y range after the matrix plot has been created?

Yes, the X,Y range can be adjusted after the matrix plot has been created. This can be done by changing the axis limits or by zooming in or out on the plot.

4. What is the difference between a matrix plot and a scatter plot?

A matrix plot is a type of scatter plot where the data points are represented by colored squares or rectangles instead of dots. This allows for a larger number of data points to be displayed in a smaller space.

5. Are there any limitations to plotting a matrix within an X,Y range?

One limitation of plotting a matrix within an X,Y range is that it can only represent data in two dimensions. This may not be suitable for more complex data sets that require three-dimensional or higher-dimensional plots. Additionally, the size and resolution of the plot may also be limited by the available screen space.

Similar threads

  • Programming and Computer Science
Replies
2
Views
1K
Replies
1
Views
1K
  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
3
Views
855
  • Programming and Computer Science
Replies
14
Views
633
  • Programming and Computer Science
Replies
2
Views
9K
  • Programming and Computer Science
Replies
15
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
4
Views
2K
Back
Top