Code covered by the BSD License  

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

Be the first to rate this file! 0 Downloads (last 30 days) File Size: 24 KB File ID: #38868 Version: 1.5
image thumbnail




01 Nov 2012 (Updated )

Meta-function and optional GUI that transforms linear mesh coordinates into a chosen graded mesh

| Watch this File

File Information

gradedmesh is a set of utilities for creating graded mesh. A graded mesh is a symmetric mesh which becomes finer at each interval. Choosing a graded mesh is problem specific therefore having a simple and efficient utility for designing them is helpful.

The core of this module is the function meshfunc which takes two parameters. Curvature and Weight. It uses these to create a parabola y(x) which defines the graded step size vector dx. The curvature parameter is the c term in the (x-a)^c part of the parabolic equation. Thus it controls how quickly dx changes step sizes and how wide the trough of the parabola is. The weight term is the ratio between the smallest dx and the largest, so weight = 0.1 would give a graded mesh where the finest mesh scale is 10% of the largest.
Calling meshfunc(curve, weight) returns a function which can be used to transform various linear dimension vectors, all using the same curve and weight parameters used to build the function. This means that multiple applications of the returned function on linear vectors performs the same transformation on all of them, regardless of their length or range. This function returns two outputs, x and dx, the transformed coordinates of the inputs.

curve = 4;
weight = 0.2;
gmesh = meshfunc(curve, weight);

% Untransformed Coordinates
x = linspace(0, 1, 100);
y = linspace(3, 3.5, 100);
z = linspace(0, 100, 1000);

% Transformed Coordinates
[x dx] = gmesh(x)
[y dy] = gmesh(y)
[z dz] = gmesh(z)
plotMesh(x, z)
plotMesh(x, y)

Function meshgui opens a gui for easy selection of the meshfunc parameters: curvature and weight.

gmesh = meshgui();

Sliders allow the user to increase and decrease both parameters and visually check the appearance of the mesh.
Note: meshgui has both plotMesh and meshfunc as dependencies, it is just a GUI wrapper around these functions, so they must be in the same directory or on the matlab path.

plotMesh is a quick function for viewing the transformed graded mesh.

See the meshtest.m file included in this module for a working example.

Required Products MATLAB
MATLAB release MATLAB 7.14 (R2012a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
02 Nov 2012 1.1

Update documentation and meshtest script.

05 Nov 2012 1.2

Added some additional tags

12 Aug 2013 1.5

Clean up files

Contact us