# multisphere

Create geometry formed by several spherical cells

## Description

## Examples

### Nested Spheres

Create a geometry that consists of three nested spheres and include this geometry in a PDE model.

Create the geometry by using the `multisphere`

function. The resulting geometry consists of three cells.

gm = multisphere([5 10 15])

gm = DiscreteGeometry with properties: NumCells: 3 NumFaces: 3 NumEdges: 0 NumVertices: 0 Vertices: []

Create a PDE model.

model = createpde

model = PDEModel with properties: PDESystemSize: 1 IsTimeDependent: 0 Geometry: [] EquationCoefficients: [] BoundaryConditions: [] InitialConditions: [] Mesh: [] SolverOptions: [1x1 pde.PDESolverOptions]

Include the geometry in the model.

model.Geometry = gm

model = PDEModel with properties: PDESystemSize: 1 IsTimeDependent: 0 Geometry: [1x1 DiscreteGeometry] EquationCoefficients: [] BoundaryConditions: [] InitialConditions: [] Mesh: [] SolverOptions: [1x1 pde.PDESolverOptions]

Plot the geometry.

pdegplot(model,'CellLabels','on','FaceAlpha',0.2)

### Single Sphere

Create a geometry that consists of a single sphere and include this geometry in a PDE model.

Use the `multisphere`

function to create a single sphere. The resulting geometry consists of one cell.

gm = multisphere(5)

gm = DiscreteGeometry with properties: NumCells: 1 NumFaces: 1 NumEdges: 0 NumVertices: 0 Vertices: []

Create a PDE model.

model = createpde

model = PDEModel with properties: PDESystemSize: 1 IsTimeDependent: 0 Geometry: [] EquationCoefficients: [] BoundaryConditions: [] InitialConditions: [] Mesh: [] SolverOptions: [1x1 pde.PDESolverOptions]

Include the geometry in the model.

model.Geometry = gm

model = PDEModel with properties: PDESystemSize: 1 IsTimeDependent: 0 Geometry: [1x1 DiscreteGeometry] EquationCoefficients: [] BoundaryConditions: [] InitialConditions: [] Mesh: [] SolverOptions: [1x1 pde.PDESolverOptions]

Plot the geometry.

pdegplot(model,'CellLabels','on')

### Hollow Sphere

Create a hollow sphere and include it as a geometry in a PDE model.

Create a hollow sphere by using the `multisphere`

function with the `Void`

argument. The resulting geometry consists of one cell.

`gm = multisphere([9 10],'Void',[true,false])`

gm = DiscreteGeometry with properties: NumCells: 1 NumFaces: 2 NumEdges: 0 NumVertices: 0 Vertices: []

Create a PDE model.

model = createpde

model = PDEModel with properties: PDESystemSize: 1 IsTimeDependent: 0 Geometry: [] EquationCoefficients: [] BoundaryConditions: [] InitialConditions: [] Mesh: [] SolverOptions: [1x1 pde.PDESolverOptions]

Include the geometry in the model.

model.Geometry = gm

model = PDEModel with properties: PDESystemSize: 1 IsTimeDependent: 0 Geometry: [1x1 DiscreteGeometry] EquationCoefficients: [] BoundaryConditions: [] InitialConditions: [] Mesh: [] SolverOptions: [1x1 pde.PDESolverOptions]

## Input Arguments

`R`

— Cell radius

positive real number | vector of positive real numbers

Cell radius, specified as a positive real number or a vector
of positive real numbers. If `R`

is a vector, then `R(i)`

specifies
the radius of the `i`

th cell.

**Example: **`gm = multisphere([1,2,3])`

`eci`

— Empty cell indicator

vector of logical `true`

or `false`

values

Empty cell indicator, specified as a vector of logical
`true`

and `false`

values. This vector
must have the same length as the radius vector
`R`

.

The value `true`

corresponds to an empty cell. By
default, `multisphere`

assumes that all cells are not
empty.

**Example: **```
gm =
multisphere([1,2,3],'Void',[false,true,false])
```

## Output Arguments

`gm`

— Geometry object

`DiscreteGeometry`

object

Geometry object, returned as a DiscreteGeometry Properties object.

## See Also

**Introduced in R2017a**

## Open Example

You have a modified version of this example. Do you want to open this example with your edits?

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

# Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)