
Make different selection for the left, rigth, top, botton and circle segment boundaries and build an indexBoundary vector using all of them. Plot(nodes(indexLeft,1),nodes(indexLeft,2), 'mo')Ĭompute the index set for all points in the boundary of the meshHole example. Instead of using =0, we introduce a small tolerance (better when using floats) =find(nodes(:,1)<0.01) %index are the node numbers The sintax is:Įxample: Select the left boundary nodes according their x-coordinate. It allow us to recover the indices (row and column) of a table that meets a condition. Plot the quadrangular mesh meshTwoHolesQuad.m using the above function.įrom the nodes of a mesh, we can select different set of points from a mathematical equation or condition.

PlotContourSolution(nodes,elem,Temp,titol,colorScale) % We will use our own function for plotting a colored mesh % it can plot both triangular and quadrangular meshes. Temp=1:numNodes %temperature for node i is assigned as T(i)=i % Just as an example we gave a temperature value for each node We have build a general function plotContourSolution.m in this case.Ĭonsider the triangle mesh in meshHole.m and assign a value of temperature for each node (like in one of our previous practices).

Using the previous approach one can represent the color interpolation of each triangle in a triangle mesh. Use also colormap('gray') to obtain a gray color image Use the same value for all nodes and you will get a flat color triangle Plot(p(1,1),p(1,2), 'ko') %plot the point using a black o Values= %can be temperature, stress, etc.Ĭolormap( 'jet') %one of the standar color maps for FEMĬolorbar %it is optional, shows the bar with the color scale nodes=[1,1 %define the nodes of a triangleĮlem= %define the triangle it self as an element Using the FILL function a color representation is obtained where each point on the triangle has an interpolated color computed from the vertices values and the colormap. Let's see an exemple considering only one element: We consider a simple example where a Triangle is defined by its nodes and a numerical value is associated to each node. It consist of a table of 64 RGB different colors associated from the maximum value (red) to the minimum one (blue).

When only one value is associated to each point, Matlab offers the possibility of chossing a color scale named colormap ( jet by default). Green: 0 <= g <= 255 (integer) or 0.0 <= g <= 1.0 (float) is the second channel īlue: 0 <= b <= 255 (integer) or 0.0 <= b <= 1.0 (float) is the third channel Ĭolor in Matlab can be specified using RGB but it also uses colormap which is an array of colors according to certain rules (jet, gray, copper, etc.) (see doc colormap in Matlab for more information) Red: 0 <= r <= 255 (integer) or 0.0 <= r <= 1.0 (float) is the first channel The main function is FILL.Ĭolor in general is defined as a triplet RGB values Matlab allow us to plot the results on the nodes of one element using color interpolation.
