Main Content

taguchiDOE

Taguchi design of experiments (DOE)

Since R2025a

    Description

    A taguchiDOE object contains a Taguchi design for an experiment. Use a Taguchi design when you want to identify controllable factors that minimize the contribution of noise factors to a process. You can use the taguchiTypes function to list the valid Taguchi design types for a specified set of factors and levels. For more information, see Taguchi Designs.

    Creation

    Description

    dtag = taguchiDOE(n,type) returns a taguchiDOE design object dtag of type type with n factors.

    example

    dtag = taguchiDOE(bounds,type) specifies the bounds for the factors in the design.

    example

    dtag = taguchiDOE(levels1,levels2,...,levelsN,type) specifies the number and levels for the factors in the design.

    example

    dtag = taguchiDOE(dinfo,type) specifies the design using the factor information dinfo, which is a structure returned by the taguchiTypes function.

    example

    dtag = taguchiDOE(___,Name=Value) specifies options using one or more name-value arguments in addition to any of the input argument combinations in the previous syntaxes. For example, you can specify the factor names and the number of levels for each factor.

    example

    Input Arguments

    expand all

    Number of factors in the design, specified as a positive integer. The valid values of n depend on the value of type. For more information, see the DesignType property description.

    Example: 4

    Data Types: single | double

    Taguchi design type, specified as a string scalar or character vector. The valid values of type depend on the value of n. You can use the taguchiTypes function to return a list of valid Taguchi design types for a set of factors and levels. For more information, see the DesignType property description.

    Example: "L4"

    Data Types: char | string

    Factor level bounds, specified as a 2-by-n matrix, where n is the number of factors in the design. Each column of bounds corresponds to a factor. The first row of bounds contains the lowest levels for the factors, and the second row contains the highest levels. If you specify NumLevelsPerFactor, each factor has NumLevelsPerFactor levels equally spaced between bounds. Otherwise, each factor has two levels.

    Example: [0 0.1 10; 5 0.7 50]

    Data Types: single | double

    Factor levels, specified as a numeric, logical, string, or categorical vector, or a cell array of character vectors. levels1,levels2,...,levelsN must contain levels for each factor in the design. The software ignores any nonunique level values that you specify for an individual factor.

    Example: ["cohorta","cohortb"],[0,0.25,0.5],["drug1","drug2","drug3"]

    Data Types: single | double | logical | char | string | cell | categorical

    Factor information, specified as a structure array returned by the taguchiTypes function.

    Data Types: struct

    Name-Value Arguments

    expand all

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: taguchiDOE(4,"L8",FactorNames=["A","B","C","D"]) specifies a four-factor L8 Taguchi design with factors named "A", "B", "C", and "D".

    Categorical factors list, specified as one of the values in this table.

    ValueDescription
    Vector of positive integers

    Each entry in the vector is an index value indicating that the corresponding factor is categorical. The index values are between 1 and n, where n is the number of factors in the design.

    Logical vector

    A true entry means that the corresponding factor is categorical. The length of the vector is n.

    String vector or cell array of character vectorsEach element in the array is the name of a factor. The names must match the entries in FactorNames.
    "all"All factors are categorical.

    By default, taguchiDOE treats all nonnumeric factors as categorical.

    Example: CategoricalFactors="all"

    Data Types: single | double | logical | char | string | cell

    Factor names, specified as a string vector or a cell array of character vectors. The number of unique values in FactorNames must equal the number of factors in the design. The default value for FactorNames is ["Factor1","Factor2",..."FactorN"].

    If you pass levels for a factor using variable names in the input argument levels1,levels2,...,levelsN and do not specify FactorNames, taguchiDOE assigns the workspace variable name to the corresponding factor.

    Example: FactorNames=["compound","quantity"]

    Data Types: char | string | cell

    Experiment model, specified as one of the following values.

    • A character vector or string scalar with the model name.

      ValueModel Description
      "linear"The model contains an intercept and linear term for each factor.
      "constant"The model contains only a constant (intercept) term.
      "interactions"The model contains an intercept, a linear term for each factor, and all products of pairs of distinct factors (no squared terms).
      "purequadratic"The model contains an intercept term, and linear and squared terms for each factor.
      "quadratic"The model contains an intercept term, linear and squared terms for each factor, and all products of pairs of distinct factors.
      "scheffe-linear"

      The model contains a linear term for each factor and does not include an intercept term.

      "scheffe-quad"

      The model is given by the formula:

      i=1nbixi+i=1nj<in1bijxixj

      "scheffe-special-cubic"

      The model is given by the formula:

      i=1nbixi+i=1nj<in1bijxixj+i=1nj<in1k<jn2bijkxixjxk

      "polyijk"The model is a polynomial with all terms up to degree i in the first factor, degree j in the second factor, and so on. Specify the maximum degree for each factor by using numerals 0 though 9. The model contains interaction terms, but the degree of each interaction term does not exceed the maximum value of the specified degrees. For example, "poly13" has an intercept and x1, x2, x22, x23, x1*x2, and x1*x22 terms, where x1 and x2 are the first and second factors, respectively.

      In the above table, each xi corresponds to the ith factor in the design, and bi, bij, bijk, and dij are coefficients for the model terms.

    • A character vector or string scalar formula in Wilkinson Notation. The factor names in the formula must be factor names specified by the FactorNames name-value argument.

    • A t-by-n terms matrix, where t is the number of terms and n is the number of factors in the design. A terms matrix is convenient when the number of factors is large and you want to generate the terms programmatically. For more information about terms matrices, see Terms Matrix.

    ModelSpecification does not include a response variable.

    Example: ModelSpecification="Factor1 + Factor2 + Factor3"

    Data Types: single | double | char | string

    Noise factors list, specified as one of the following values. If you specify NoiseFactors, you must also specify NoiseDesignType.

    ValueDescription
    Vector of positive integers

    Each entry in the vector is an index value indicating that the corresponding factor is a noise factor. The index values are between 1 and n, where n is the number of factors in the design.

    Logical vector

    A true entry means that the corresponding factor is a noise factor. The length of the vector is n.

    String vector or cell array of character vectorsEach element in the array is the name of a factor. The names must match the entries in FactorNames.

    Example: NoiseFactors=[1 2]

    Data Types: single | double | logical | char | string | cell

    Taguchi design type for the noise factors, specified as a string scalar or character vector. If you specify NoiseDesignType, you must also specify NoiseFactors. The valid values of NoiseDesignType depend on the number of levels in the noise factors. You can use the taguchiTypes function to return a list of valid Taguchi design types. For more information, see the DesignType property description.

    Example: NoiseDesignType="L4"

    Data Types: char | string

    Number of levels for each factor, specified as a positive integer or a vector of positive integers. NumLevelsPerFactor must have an element for each factor in the design. If you specify NumLevelsPerFactor as a positive integer, the software assigns NumLevelsPerFactor levels to each factor.

    Example: NumLevelsPerFactor=[2,2,4]

    Data Types: single | double

    Properties

    expand all

    This property is read-only.

    This property is read-only after object creation.

    Categorical factors, specified as a vector of indices indicating which factors are categorical. This property is set by the CategoricalFactors name-value argument when you create the taguchiDOE object.

    Data Types: double

    This property is read-only.

    Generated design points, represented as a table. Each column of Design corresponds to a factor in the design, and each row corresponds to a point.

    Data Types: table

    This property is read-only after object creation.

    Factor levels, represented as a cell array with one element per factor. The software uses the value of levels1,levels2,...,levelsN or dinfo to set Levels. Otherwise, the software sets the elements of Levels to have n equally spaced levels in the range specified by bounds (or [-1 1] if you do not specify bounds). The value of n is determined as follows:

    • If you do not specify ModelSpecification or NumLevelsPerFactor, then n equals 2.

    • If you specify NumLevelsPerFactor, then n equals NumLevelsPerFactor.

    • If you specify ModelSpecification and do not specify NumLevelsPerFactor, then n equals 1 + the maximum order of the ModelSpecification model.

    Data Types: cell

    This property is read-only.

    Experiment model, specified as a formula in Wilkinson Notation. ModelSpecification indicates the model you want to fit with the specified design. ModelSpecification does not include the response variable.

    This property is set by the ModelSpecification name-value argument when you create the taguchiDOE object.

    Data Types: string

    This property is read-only after object creation.

    Noise factors list, represented as a vector of indices indicating which factors are noise factors. This property is set by the NoiseFactors name-value argument when you create the taguchiDOE object.

    Data Types: single | double

    This property is read-only after object creation.

    Taguchi design type, represented as a string scalar or a string vector. When DesignType is a string scalar, it consists of "L" and a number that corresponds to the number of points in the Taguchi design. If you specify NoiseDesignType, then DesignType is a string vector containing the non-noise design type and the noise design type. This property is set by the type input argument and NoiseDesignType name-value argument when you create the taguchiDOE object.

    Each design type can support up to a maximum number of factors with levels as described in the following table. An empty table cell indicates that the design does not support that factor type in combination with the other factor types in the same row. For example, the "L8" design can support up to 7 two-level factors, or a combination of up to 4 two-level factors and 1 four-level factor. This design does not support any five-level or six-level factors.

    ValueTwo-Level FactorsThree-Level FactorsFour-Level FactorsFive-Level FactorsSix-Level Factors
    "L4"3    
    "L8"7    
    "L8"4 1  
    "L9" 4   
    "L12"11    
    "L16"15    
    "L16"12 1  
    "L16"9 2  
    "L16"6 3  
    "L16"3 4  
    "L16"  5  
    "L18"17   
    "L18" 6  1
    "L25"   6 
    "L27" 13   
    "L32"31    
    "L32"1 9  
    "L36"1112   
    "L36"313   
    "L50"1  11 
    "L54"125   
    "L64"  21  
    "L64"31    
    "L81" 40   

    Data Types: string

    Object Functions

    fitlmFit linear regression model using design points
    snrTaguchi DOE signal-to-noise ratio (SNR)
    plotsnrPlot signal-to-noise ratio (SNR) for Taguchi design factors

    Examples

    collapse all

    Generate a Taguchi L4 design with two factors.

    dtag = taguchiDOE(2,"L4")
    dtag = 
      taguchiDOE with properties:
    
                    Design: [4×2 table]
        ModelSpecification: "1 + Factor1 + Factor2"
                    Levels: {[-1 1]  [-1 1]}
        CategoricalFactors: []
              NoiseFactors: []
                DesignType: "L4"
    
    

    dtag is a taguchiDOE object that contains information about the generated Taguchi design. The output includes the size of the table containing the design runs, and the model for the design. By default, the levels for each factor are –1 and 1.

    Display the design table.

    dtag.Design
    ans=4×2 table
        Factor1    Factor2
        _______    _______
    
          -1         -1   
          -1          1   
           1         -1   
           1          1   
    
    

    The L4 design table contains four runs with values for the two factors.

    Generate a Taguchi L4 design and specify the factor bounds for the design points.

    dtag = taguchiDOE([10 15 20; 15 20 25],"L4")
    dtag = 
      taguchiDOE with properties:
    
                    Design: [4×3 table]
        ModelSpecification: "1 + Factor1 + Factor2 + Factor3"
                    Levels: {[10 15]  [15 20]  [20 25]}
        CategoricalFactors: []
              NoiseFactors: []
                DesignType: "L4"
    
    

    dtag is a taguchiDOE object that contains information about the generated Taguchi L4 design. By default, the levels for the factors are the same as the specified bounds.

    Generate data for the health status of 50 patients using the randi function. Create variables containing levels for patient age and smoking status.

    healthStatus = randi([1 3],50,1);
    age = [20 30 40];
    smoker = ["Y", "N"];

    Generate a Taguchi L18 design using the unique values in the variables age, smoker, and healthStatus as the factor levels.

    dtag = taguchiDOE(age,smoker,healthStatus,"L18")
    dtag = 
      taguchiDOE with properties:
    
                    Design: [18×3 table]
        ModelSpecification: "1 + age + smoker + healthStatus"
                    Levels: {[20 30 40]  ["N"    "Y"]  [1 2 3]}
        CategoricalFactors: 2
              NoiseFactors: []
                DesignType: "L18"
    
    

    dtag is a taguchiDOE object that contains information about the generated Taguchi design.

    Display the design table.

    dtag.Design
    ans=18×3 table
        age    smoker    healthStatus
        ___    ______    ____________
    
        20      "N"           1      
        20      "N"           2      
        20      "N"           3      
        20      "Y"           1      
        20      "Y"           2      
        20      "Y"           3      
        30      "N"           1      
        30      "N"           2      
        30      "N"           3      
        30      "Y"           1      
        30      "Y"           2      
        30      "Y"           3      
        40      "N"           1      
        40      "N"           2      
        40      "N"           3      
        40      "Y"           1      
          ⋮
    
    

    The design table displays the factor values for the 18 runs in the Taguchi L18 design.

    Use the taguchiTypes function to return a vector of valid Taguchi design types for four factors. Additionally return a structure containing information about the factors.

    [types,dinfo] = taguchiTypes(4)
    types = 1×3 string
        "L8"    "L12"    "L16"
    
    
    dinfo = struct with fields:
                    Levels: {[-1 1]  [-1 1]  [-1 1]  [-1 1]}
        CategoricalFactors: []
               FactorNames: ["Factor1"    "Factor2"    "Factor3"    "Factor4"]
        ModelSpecification: "linear"
        NumLevelsPerFactor: [2 2 2 2]
              NoiseFactors: []
              ModelSpecSet: 0
    
    

    The valid types for a Taguchi design with 4 factors are "L8", "L12", and "L16". By default, each factor contains levels –1 and 1.

    Create a four-factor Taguchi L12 design using the factor information contained in the structure returned by taguchiTypes. Display the design table.

    dtag = taguchiDOE(dinfo,"L12");
    dtag.Design
    ans=12×4 table
        Factor1    Factor2    Factor3    Factor4
        _______    _______    _______    _______
    
          -1         -1         -1         -1   
          -1         -1         -1         -1   
          -1         -1          1          1   
          -1          1         -1          1   
          -1          1          1         -1   
          -1          1          1          1   
           1         -1          1          1   
           1         -1          1         -1   
           1         -1         -1          1   
           1          1          1         -1   
           1          1         -1          1   
           1          1         -1         -1   
    
    

    Generate an inner Taguchi L18 design for two factors with levels [-1,1] and [1,2,3], respectively. Add an outer Taguchi L4 design that has a single noise factor with levels [1,2]. The inner design contains controllable factors, while the outer design contains a noise factor that is present in the laboratory.

    dtag=taguchiDOE([-1,1],[1,2,3],[1,2],"L18", ...
        NoiseDesignType="L4",NoiseFactors=3)
    dtag = 
      taguchiDOE with properties:
    
                    Design: [72×3 table]
        ModelSpecification: "1 + Factor1 + Factor2"
                    Levels: {[-1 1]  [1 2 3]  [1 2]}
        CategoricalFactors: []
              NoiseFactors: 3
                DesignType: ["L18"    "L4"]
    
    

    dtag is a taguchiDOE object that contains information about the generated Taguchi design. The output includes the size of the table containing the design runs, and the model for the design.

    Display the design.

    dtag.Design
    ans=72×3 table
        Factor1    Factor2    Factor3
        _______    _______    _______
    
          -1          1          1   
          -1          1          1   
          -1          1          2   
          -1          1          2   
          -1          1          1   
          -1          1          1   
          -1          1          2   
          -1          1          2   
          -1          1          1   
          -1          1          1   
          -1          1          2   
          -1          1          2   
          -1          2          1   
          -1          2          1   
          -1          2          2   
          -1          2          2   
          ⋮
    
    

    More About

    expand all

    References

    [1] Krishnaian, K., and P. Shahabudeen. Applied Design of Experiments and Taguchi Methods. New Delhi: PHI Learning Private Limited, 2012.

    Version History

    Introduced in R2025a