1 Introduction

In 1975, Zadeh proposed the definition and operation of type-2 fuzzy sets [1]. 1976–2002, M. Mizumoto and K. Tanaka, R. I. John, Karnik and J. M. Mendel studied the properties of type-2 fuzzy sets [2,3,4,5]. In 1985, Takagi and Sugeno design T–S model [6]. In the complex, nonlinear, multivariable system modeling and control, the superiority of the application is gradually shown. In 1988, Sugeno and Kang extend this method by adding an unbiasedness constraint, get the TSK model [7]. At this stage, fuzzy theory has been widely used in many fields, such as chemical plant, subway, robot and so on [8,9,10]. In 1999, J. M. Mendel proposed type-2 fuzzy logic and fuzzy logic system, forming the theoretical framework of the type-2 fuzzy logic system [11, 12]. In 2007, O. Castillo and P. Melin have done a lot of work on the fuzzy theory and the application of interval type-2 fuzzy logic system to control problems. At the same time, the use of computer software technology (genetic algorithm, neural network, etc.), as well as software systems, greatly improve the convenience and practicality of the application [13, 14]. The application of type-2 fuzzy logic can better deal with the uncertainty in the language, thus reducing the uncertainty in the system. The type-2 TSK fuzzy system is extended from the corresponding type-1 TSK fuzzy system. The type-2 TSK fuzzy system has the ability of universal approximation and good robustness and has the ability to model complex input–output relations. In recent years, it has been successfully applied in many fields, such as control, prediction [15,16,17,18], communication and so on [19,20,21,22,23,24,25,26,27,28,29]. Recent theoretical and practical studies confirm that IT2FLSs handle uncertainties more appropriately than their type-1 counterparts [30]. Due to the complexity and difficulty of the ordinary type-2 TSK fuzzy system, the application of interval type-2 TSK fuzzy system can greatly reduce the computational complexity.

In 1995, particle swarm optimization (PSO) algorithm is a population-based optimization algorithm proposed by Kennedy and Eberhart [31, 32]. Because the PSO algorithm is easy to fall into the local optimal solution, Sun et al. [33,34,35] proposed a QPSO algorithm based on the standard PSO in 2004. QPSO algorithm is a new model of particle swarm optimization algorithm from the point of view of quantum mechanics. The model think the particle have the behavior of quanta, using the Heisenberg uncertainty principle to describe the motion state of the particle, the particle can be searched in the whole feasible solution space, thereby obtaining global optimization solution. Therefore, the QPSO algorithm is a globally convergent iterative search algorithm. In 2010, Lian et al. [36] applied the QPSO algorithm to the radial basis function neural network. In 2011, Zhai et al. [37] applied the QPSO algorithm to a non-singleton interval type-2 fuzzy logic system of universal image noise removal. In 2013, Pan et al. [38] applied the QPSO algorithm to the hybrid fuzzy neural network. In 2015, Wei Wang used adaptive QPSO algorithm to train radial basis function neural network, and applied it to traffic flow prediction [39]. In 2016, Zhu et al. [40] combine QPSO algorithm and radial basis function neural network and apply it to short-term power load forecasting. They found that through the optimization of the QPSO algorithm, the model has high prediction accuracy and stability. In 2016, Liu et al. [41] used QPSO algorithm to optimize the fuzzy neural network, and applied to the digital simulation. In the same year, Li et al. [42] used QPSO algorithm to optimize RBF neural network and applied to text classification. It is found that the QPSO algorithm improves the learning speed, accuracy and robustness. In 2014, Mendel et al. [43] proposed using the QPSO algorithm to train the fuzzy logic system. At present, the design of the fuzzy logic system is mostly using the BP algorithm, the least-square algorithm and the hybrid algorithm, etc. The least-squares method only used to tune the consequent parameters. The BP algorithm needs to compute the partial derivative, which is more complex, and cannot guarantee the global convergence. The convergence speed of genetic algorithm is slow when dealing with complex optimization problems. The PSO algorithm is easy to fall into the local optimal solution. The QPSO intelligent algorithm does not need to adjust the velocity vector, and the parameters need to be adjusted are few, the form is simple, the precision is high, the convergence speed is fast, and it has strong global convergence. Although the QPSO intelligent algorithm in dealing with complex optimization problems, the stability is relatively poor, but it has a strong global convergence and can find the global optimal solution of the optimization problem with fewer iterations and less time consuming to have the same solution precision and other algorithms. At present, scholars have used intelligent algorithm to design the system [44, 45], but few scholars use QPSO intelligent algorithm to design fuzzy logic system and apply it to prediction. By combining with the TSK fuzzy logic system and the neural network, this paper designed six layers fuzzy neural network system. The QPSO intelligent algorithm was used to tune the fuzzy logic system parameters, and the design of intelligent system is applied in the prediction of the Nasdaq Composite Index and International Gold Prices with the impact of uncertainty. By comparing the performance of QPSO and BP algorithm, the root-mean-square error (RMSE) and simulation results illustrated the effectiveness of the proposed design method, which obtained better effect in contrast with the BP algorithm.

The rest of the paper is organized as follows: in Sect. 2, we present the principle of QPSO algorithm. In Sect. 3, the design of fuzzy logic system based on QPSO algorithm is introduced. Section 4 presents application of the QPSO-trained fuzzy logic system in the Nasdaq Composite Index and International Gold Prices. Finally, the paper is concluded in Sect. 5.

2 QPSO Algorithm

In the PSO with M individuals, each individual is treated as an infinitesimal particle in the D-dimensional space, with the current position vector and velocity vector of particle i at the nth iteration represented as X i,n  = (X 1 i,n X 2 i,n , …, X D i,n ) and V i,n  = (V 1 i,n V 2 i,n , …, V D i,n ) [31, 32]. The particle moves according to the following equations:

$$V_{i,n + 1}^{j} = \omega V_{i,n}^{j} + c_{1} r_{i,n}^{j} (P_{i,n}^{j} - X_{i,n}^{j} ) + c_{2} R_{i,n}^{j} (G_{i,n}^{j} - X_{i,n}^{j} )$$
(1)
$$X_{i,n + 1}^{j} = X_{i,n}^{j} + V_{i,n + 1}^{j}$$
(2)

where i = 1, 2, …, Mj = 1, 2, …, D, c 1 and c 2 are the acceleration coefficients. The parameter ω is the inertia weight. The parameters r j i,n and R j i,n are random numbers, \(r_{i,n}^{j} ,R_{i,n}^{j} \sim\,U(0,1)\), V j i,n  ∊ [−V maxV max]. P i,n  = (P 1 i,n P 2 i,n , …, P D i,n ) is the best previous position of particle i, G n  = (G 1 n G 2 n , …, G D n ) is the global best position.

In order to overcome the shortcoming that PSO algorithm is easy to fall into local optimal solution, QPSO algorithm is proposed [33]. In the QPSO algorithm, the position and velocity vector of each particle is replaced by the wave function. The population size of the particle is M, and the position of the particle is updated according to the following equations:

$$X_{i,n + 1}^{j} = P_{i,n}^{j} \pm \alpha \cdot \left| {X_{i,n}^{j} - C_{i,n}^{j} } \right| \cdot \ln \left( {\frac{1}{{u_{i,n + 1}^{j} }}} \right)$$
(3)
$$C_{n}^{j} = \left( {\frac{1}{M}} \right)\sum\limits_{i = 1}^{M} {p_{i,n}^{j} } \quad (1 \le j \le D)$$
(4)
$$P_{i,n}^{j} = \varphi_{i,n}^{j} \cdot P_{i,n}^{j} + (1 - \varphi_{i,n}^{j} ) \cdot G_{n}^{j}$$
(5)

where C n  = (C 1 n C 2 n , …, C D n ) is mean best position defined by the average of the personal best positions among all the particles, φ j i,n and u j i,n+1 are random numbers uniformly distributed between (0, 1). The parameter α is contraction–expansion (CE) coefficient, and the convergence speed is controlled.

3 Design of Interval Type-2 TSK Fuzzy Logic System

3.1 System Model

3.1.1 A1–C1 Interval Type-2 Fuzzy Logic System

The A1–C1 interval type-2 fuzzy logic system having n inputs and one output, we assume there are M rules, the kth rule can be expressed as:

$$\begin{aligned} & R^{k}{:}\,{\text{IF}}\quad x_{1} \quad {\text{is}}\,F_{1}^{k} \quad {\text{and}}\quad x_{2} \,{\text{is}}\,F_{2}^{k} \quad {\text{and}} \cdots {\text{and}}\quad x_{n} \,{\text{is}}\,F_{n}^{k} , \\ & {\text{THEN}}\,Y^{k} \,{\text{is}}\,C_{0}^{k} + C_{1}^{k} x_{1} + C_{2}^{k} x_{2} + \cdots + C_{n}^{k} x_{n} \quad \quad k = 1, \ldots ,M \\ \end{aligned}$$

where F k1 F k2 , …, F k n are the membership functions of the antecedent, the type-1 fuzzy set. Y k is the consequent of the kth rule, C k0 C k1 , …, C k n are type-1 fuzzy set of the consequent parameters. C k i  = [c k i  − s k i c k i  + s k i ] (i = 0, 1…, n), c k i is the center of C k i , s k i is the span of C k i .

The fuzzy logic system is integrated into the neural network to get the six layers fuzzy neural network system, the system structure is as follows:

Layer 1: Input layer: X = (x 1x 2, …, x n )T

Layer 2: Membership functions layer: which adopts a Gaussian shape. The membership grades of each node is described as

$$\mu_{{F_{i}^{k} }} \left( {x_{i} } \right) = \exp \left\{ { - \frac{1}{2}\left( {\frac{{x_{i} - m_{{F_{i}^{k} }} }}{{\sigma_{{F_{i}^{k} }} }}} \right)^{2} } \right\}\quad i = 1,2, \ldots ,n,\quad k = 1,2, \ldots ,M$$

Layer 3: The rules layer: F k are rule firing strengths, defined as:

$$F^{k} = \prod\limits_{i = 1}^{n} {\mu_{{F_{i}^{k} }} \left( {x_{i} } \right)}$$

Layer 4: The weight layer: calculate the weight of rules:

$$\omega^{k} = \frac{{F^{k} }}{{\sum\limits_{k = 1}^{M} {F^{k} } }}$$

Layer 5: The rules’ consequent layer:

$$Y^{k} = \left[ {y_{l}^{k} ,y_{r}^{k} } \right]$$

where y k l  = ∑ n i=1 c k i x i  + c k0  − ∑ n i=1 |x i |s k i  − s k0 , y k r  = ∑ n i=1 c k i x i  + c k0  + ∑ n i=1 |x i |s k i  + s k0

Layer 6: Output layer: y is the output of the system

$$y = f_{s} \left( X \right) = \frac{{y_{l} + y_{r} }}{2} = \frac{{\sum\nolimits_{k = 1}^{M} {\omega^{k} \left( {\sum\nolimits_{i = 1}^{n} {c_{i}^{k} x_{i} + c_{0}^{k} } } \right)} }}{{\sum\nolimits_{k = 1}^{M} {\omega^{k} } }}.$$

3.1.2 A2–C0 Interval Type-2 Fuzzy Logic System

The A2–C0 interval type-2 fuzzy logic system having n inputs and one output, we assume there are M rules, the kth rule can be expressed as:

$$\begin{aligned} & R^{k} {:}\,{\text{IF}}\quad x_{1} \,{\text{is}}\,\tilde{F}_{1}^{k} \quad {\text{and}}\quad x_{2} \,{\text{is}}\,\tilde{F}_{2}^{k} \quad {\text{and}} \cdots {\text{and}}\quad x_{n} \,{\text{is}}\tilde{F}_{n}^{k} , \\ & {\text{THEN}}\,Y^{k} \,{\text{is}}\,p_{0}^{k} + p_{1}^{k} x_{1} + p_{2}^{k} x_{2} + \cdots + p_{n}^{k} x_{n} \quad \quad k = 1, \ldots ,M \\ \end{aligned}$$

where \(\tilde{F}_{1}^{k} ,\tilde{F}_{2}^{k} , \ldots ,\tilde{F}_{n}^{k}\) are the membership functions of the antecedent, the interval type-2 fuzzy set. Y k is the consequent of the kth rule, p k0 p k1 , …, p k n are the consequent parameters.

The fuzzy logic system is integrated into the neural network to get the five layers fuzzy neural network system, the system structure is as follows:

Layer 1: Input layer: X = (x 1x 2, …, x n )T

Layer 2: Membership functions layer: which adopts a Gaussian shape. The membership grades of each node is described as

$$\tilde{\mu }_{{\tilde{F}_{i}^{k} }} \left( {x_{i} } \right) = \left[ {\underline{\mu }_{{\tilde{F}_{i}^{k} }} ,\overline{\mu }_{{\tilde{F}_{i}^{k} }} } \right]\quad i = 1, 2, \ldots , n,\quad k = 1, 2, \ldots , M$$

where \(\underline{\mu }_{{\tilde{F}_{i}^{k} }} \left( {x_{i} } \right) = \exp \left\{ { - \frac{1}{2}\left( {\frac{{x_{i} - \underline{m}_{{\tilde{F}_{i}^{k} }} }}{{\underline{\sigma }_{{\tilde{F}_{i}^{k} }} }}} \right)^{2} } \right\}\), \(\overline{\mu }_{{\tilde{F}_{i}^{k} }} \left( {x_{i} } \right) = \exp \left\{ { - \frac{1}{2}\left( {\frac{{x_{i} - \overline{m}_{{\tilde{F}_{i}^{k} }} }}{{\overline{\sigma }_{{\tilde{F}_{i}^{k} }} }}} \right)^{2} } \right\}\)

Layer 3: The rules layer: F k are rule firing strengths, defined as:

$$F^{k} = \left[ {\underline{F}^{k} ,\overline{F}^{k} } \right]$$

where \(\underline{F}^{k} = \prod\limits_{i = 1}^{n} {\underline{\mu }_{{\tilde{F}_{i}^{k} }} \left( {x_{i} } \right)}\), \(\overline{F}^{k} = \prod\limits_{i = 1}^{n} {\overline{\mu }_{{\tilde{F}_{i}^{k} }} \left( {x_{i} } \right)}\)

Layer 4: The weight layer: calculate the weight of rules:

$$\underline{f}^{k} = \frac{{\underline{F}^{k} }}{{\sum\nolimits_{k = 1}^{M} {\underline{F}^{k} } }},\quad \overline{f}^{k} = \frac{{\overline{F}^{k} }}{{\sum\nolimits_{k = 1}^{M} {\overline{F}^{k} } }}$$

Layer 5: Output layer: y is the output of the system

$$y = f_{\text{s}} \left( X \right) = \sum\limits_{k = 1}^{M} {f^{k} Y^{k} } .$$

Y k is a linear function of x 1x 2, …, x n , Y k = p k0  + p k1 x 1 + p k2 x 2 + ··· + p k n x n

3.1.3 A2–C1 Interval Type-2 Fuzzy Logic System

The A2–C1 interval type-2 fuzzy logic system having n inputs and one output, we assume there are M rules, the kth rule can be expressed as:

$$\begin{aligned} & R^{k}{:}\,{\text{IF}}\quad x_{1} \,{\text{is}}\,\tilde{F}_{1}^{k} \quad {\text{and}}\quad x_{2} \,{\text{is}}\,\tilde{F}_{2}^{k} \quad {\text{and}} \cdots {\text{and}}\quad x_{n} \,{\text{is}}\,\tilde{F}_{n}^{k} , \\ & {\text{THEN}}\,Y^{k} \,{\text{is}}\,C_{0}^{k} + C_{1}^{k} x_{1} + C_{2}^{k} x_{2} + \cdots + C_{n}^{k} x_{n} \quad \quad k = 1, \ldots ,M \\ \end{aligned}$$

where \(\tilde{F}_{1}^{k} ,\tilde{F}_{2}^{k} , \ldots ,\tilde{F}_{n}^{k}\) are the membership functions of the antecedent, the interval type-2 fuzzy set. Y k is the consequent of the kth rule, C k0 C k1 , …, C k n are type-1 fuzzy set of the consequent parameters. C k i  = [c k i  − s k i c k i  + s k i ] (i = 0, 1…, n), c k i is the center of C k i , s k i is the span of C k i .

The fuzzy logic system is integrated into the neural network to get the six layers fuzzy neural network system, the system structure is as follows:

Layer 1: Input layer: X = (x 1x 2, …, x n )T

Layer 2: Membership functions layer: which adopts a Gaussian shape. The membership grades of each node is described as

$$\tilde{\mu }_{{\tilde{F}_{i}^{k} }} \left( {x_{i} } \right) = \left[ {\underline{\mu }_{{\tilde{F}_{i}^{k} }} ,\overline{\mu }_{{\tilde{F}_{i}^{k} }} } \right]\quad i = 1,2, \ldots ,n,\quad k = 1,2, \ldots ,M$$

where \(\underline{\mu }_{{\tilde{F}_{i}^{k} }} \left( {x_{i} } \right) = \exp \left\{ { - \frac{1}{2}\left( {\frac{{x_{i} - \underline{m}_{{\tilde{F}_{i}^{k} }} }}{{\underline{\sigma }_{{\tilde{F}_{i}^{k} }} }}} \right)^{2} } \right\}\), \(\overline{\mu }_{{\tilde{F}_{i}^{k} }} \left( {x_{i} } \right) = \exp \left\{ { - \frac{1}{2}\left( {\frac{{x_{i} - \overline{m}_{{\tilde{F}_{i}^{k} }} }}{{\overline{\sigma }_{{\tilde{F}_{i}^{k} }} }}} \right)^{2} } \right\}\)

Layer 3: The rules layer: F k are rule firing strengths, defined as:

$$F^{k} = \left[ {\underline{F}^{k} ,\overline{F}^{k} } \right]$$

where \(\underline{F}^{k} = \prod\limits_{i = 1}^{n} {\underline{\mu }_{{\tilde{F}_{i}^{k} }} \left( {x_{i} } \right)}\), \(\overline{F}^{k} = \prod\limits_{i = 1}^{n} {\overline{\mu }_{{\tilde{F}_{i}^{k} }} \left( {x_{i} } \right)}\)

Layer 4: The weight layer: calculate the weight of rules:

$$\underline{f}^{k} = \frac{{\underline{F}^{k} }}{{\sum\nolimits_{k = 1}^{M} {\underline{F}^{k} } }},\quad \overline{f}^{k} = \frac{{\overline{F}^{k} }}{{\sum\nolimits_{k = 1}^{M} {\overline{F}^{k} } }}$$

Layer 5: The rules’ consequent layer:

$$Y^{k} = \left[ {y_{l}^{k} ,y_{r}^{k} } \right]$$

where y k l  = ∑ n i=1 c k i x i  + c k0  − ∑ n i=1 |x i |s k i  − s k0 , y k r  = ∑ n i=1 c k i x i  + c k0  + ∑ n i=1 |x i |s k i  + s k0

Layer 6: Output layer: y is the output of the system.

$$y = f_{\text{s}} \left( X \right) = \frac{{y_{l} + y_{r} }}{2}$$

where

$$\begin{aligned} y_{l} & = \frac{{\sum\nolimits_{k = 1}^{M} {\underline{f}^{k} y_{l}^{k} } }}{{\sum\nolimits_{k = 1}^{M} {\underline{f}^{k} } }} = \frac{{\sum\nolimits_{k = 1}^{L} {\overline{f}^{k} y_{l}^{k} } + \sum\nolimits_{k = L + 1}^{M} {\underline{f}^{k} y_{l}^{k} } }}{{\sum\nolimits_{k = 1}^{L} {\overline{f}^{k} } + \sum\nolimits_{k = L + 1}^{M} {\underline{f}^{k} } }} \\ y_{r} & = \frac{{\sum\nolimits_{k = 1}^{M} {\overline{f}^{k} y_{r}^{k} } }}{{\sum\nolimits_{k = 1}^{M} {\overline{f}^{k} } }} = \frac{{\sum\nolimits_{k = 1}^{R} {\underline{f}^{k} y_{r}^{k} } + \sum\nolimits_{k = R + 1}^{M} {\overline{f}^{k} y_{r}^{k} } }}{{\sum\nolimits_{k = 1}^{R} {\underline{f}^{k} } + \sum\nolimits_{k = R + 1}^{M} {\overline{f}^{k} } }} \\ \end{aligned}$$

RL are found by using KM algorithm [46], and then get y l y r .

3.2 Parameters Tuning of Fuzzy Logic System Based on QPSO Algorithm

This section presents how to employ the QPSO algorithm to tune the parameters of the fuzzy logic system. The fuzzy logic system has two types of parameters which need to be tuned, that is, the premise parameters and the consequent parameters. In the design of fuzzy logic system, the three premise parameters are \(\left\{ {m_{{F_{i}^{k} }} ,\sigma_{{F_{i}^{k} }} } \right\}\), \(\left\{ {\underline{m}_{{\tilde{F}_{i}^{k} }} ,\overline{m}_{{\tilde{F}_{i}^{k} }} ,\underline{\sigma }_{{\tilde{F}_{i}^{k} }} ,\overline{\sigma }_{{\tilde{F}_{i}^{k} }} } \right\}\), \(\left\{ {\underline{m}_{{\tilde{F}_{i}^{k} }} ,\overline{m}_{{\tilde{F}_{i}^{k} }} ,\underline{\sigma }_{{\tilde{F}_{i}^{k} }} ,\overline{\sigma }_{{\tilde{F}_{i}^{k} }} } \right\}\), respectively. The consequent parameters are {c k0 c k1 , …, c k n s k0 s k1 , …, s k n }, {p k0 p k1 , …, p k n }, {c k0 c k1 , …, c k n s k0 s k1 , …, s k n }, respectively. The premise parameters and the consequent parameters are identified by the QPSO algorithm. Thus, the position of each particle in the QPSO represents a set of premise parameters and consequent parameters. The fitness function is defined as error between actual output and desired output, which can be expressed by

$$E_{j} = \frac{1}{2}*[f_{\text{s}} (X^{j} ) - Y^{j} ]^{2}$$
(6)

And the performance index of the system is root-mean-square error (RMSE):

$${\text{RMSE}} = \sqrt {\frac{1}{K}\sum\nolimits_{j = 1}^{K} {\left( {f_{s} (X^{j} ) - Y^{j} } \right)^{2} } }$$
(7)

where Y j is the desired output, and f s(X j) is the output of the system.

The QPSO algorithm is used to tune the parameters of the fuzzy logic system as follows:

  • Step 1: Initialize the swarm of particles such that the position of each particle are uniformly distributed within the search scope, set the maximum iteration N max.

  • Step 2: Set the position of each particle X i,n as the parameters of the fuzzy logic system. Then calculate fitness value of each particle, and set each particle’s personal best position as P i,0 = X i,0.

  • Step 3: Find out the mean value of all particles’ personal best position C n by using (4).

  • Step 4: For each particle in the population, execute from Steps 5–8.

  • Step 5: Calculate each particle’s fitness value, E(X i,n ), and then compare it with the fitness of its personal best position, E(P i,n−1). If E(X i,n ) < E(P i,n−1), then P i,n  = X i,n , otherwise, P i,n  = P i,n−1.

  • Step 6: Compare the fitness value of each particle’s personal best position, E(P i,n ) with that of the global best position, E(G n−1). If E(P i,n ) < E(G n−1), then G n  = P i,n , otherwise, G n  = G n−1.

  • Step 7: Properly select the value of α.

  • Step 8: Update the position of each particle X i,n by using (3) and (5).

  • Step 9: If the termination condition is met, output the results, otherwise go to Step 2, and set the iteration number n = n + 1.

4 Application and Simulation Results

4.1 The Application of System Model in Prediction of the Nasdaq Composite Index

The Nasdaq Composite Index is the average stock price index that reflects the changes in the Nasdaq stock market. The index is one of the most representative of the US stock market index, is a representative of the various sectors of the market value of the barometer of change. Currently, the index includes more than 5 thousand companies, more than any other single securities market. It has become one of the most influential indexes of the stock market because of its wide base. In this example, the Nasdaq Composite Index were selected from July 1, 2015 to April 30, 2016, a total of 210 data. Using Matlab to draw the 210 data of the noiseless sequence diagram is shown in Fig. 1.

Fig. 1
figure 1

The diagram of Nasdaq Composite Index

In this paper, we use the first four data to predict the next data, that is, four inputs X = (x 1x 2x 3x 4)T and one output y ∊ Y. In the fuzzy logic system, the rule’s antecedent is the Gaussian membership function. The fuzzy logic system is designed by using singleton fuzzifier, product inference. Set the number of rules M = 16, the kth rules of the three fuzzy logic systems are as follows:

$$\begin{aligned} & R^{k}{:}\,{\text{IF}}\quad x_{1} \,{\text{is}}\,F_{1}^{k} \quad {\text{and}}\quad x_{2} \,{\text{is}}\,F_{2}^{k} \quad {\text{and}} \cdots {\text{and}}\quad x_{4} \,{\text{is}}\,F_{4}^{k} , \\ & {\text{THEN}}\,Y^{k} \,{\text{is}}\,C_{0}^{k} + C_{1}^{k} x_{1} + C_{2}^{k} x_{2} + \cdots + C_{4}^{k} x_{4} \quad \quad k = 1, \ldots ,16 \\ \end{aligned}$$

where F k1 F k2 F k3 F k4 are the membership functions of the antecedent, the type-1 fuzzy set. Y k is the consequent of the kth rule, C k0 C k1 , …, C k4 are type-1 fuzzy set of the consequent parameters. C k i  = [c k i  − s k i c k i  + s k i ] (i = 0, 1…, 4), c k i is the center of C k i , s k i is the span of C k i .

$$\begin{aligned} & R^{k}{:}\,{\text{IF}}\quad x_{1} \, {\text{is}}\,\tilde{F}_{1}^{k} \quad {\text{and}}\quad x_{2} \,{\text{is}}\,\tilde{F}_{2}^{k} \quad {\text{and}} \cdots {\text{and}}\quad x_{4} \,{\text{is}}\,\tilde{F}_{4}^{k} , \\ & {\text{THEN}}\,Y^{k} \,{\text{is}}\,p_{0}^{k} + p_{1}^{k} x_{1} + p_{2}^{k} x_{2} + \cdots + p_{4}^{k} x_{4} \quad \quad k = 1, \ldots ,16 \\ \end{aligned}$$

where \(\tilde{F}_{1}^{k} ,\tilde{F}_{2}^{k} ,\tilde{F}_{3}^{k} ,\tilde{F}_{4}^{k}\) are the membership functions of the antecedent, the interval type-2 fuzzy set. Y k is the consequent of the kth rule, p k0 p k1 , …, p k4 are the consequent parameters.

$$\begin{aligned} & R^{k}{:}\,{\text{IF}}\quad x_{1} \, {\text{is}}\,\tilde{F}_{1}^{k} \quad {\text{and}}\quad x_{2} \,{\text{is}}\,\tilde{F}_{2}^{k} \quad {\text{and}} \cdots {\text{and}}\quad x_{4} \,{\text{is}}\,\tilde{F}_{4}^{k} , \\ & {\text{THEN}}\,Y^{k} \,{\text{is}}\,C_{0}^{k} + C_{1}^{k} x_{1} + C_{2}^{k} x_{2} + \cdots + C_{4}^{k} x_{4} \quad \quad k = 1, \ldots ,16 \\ \end{aligned}$$

where \(\tilde{F}_{1}^{k} ,\tilde{F}_{2}^{k} ,\tilde{F}_{3}^{k} ,\tilde{F}_{4}^{k}\) are the membership functions of the antecedent, the interval type-2 fuzzy set. Y k is the consequent of the kth rule, C k0 C k1 , …, C k4 are type-1 fuzzy set of the consequent parameters.

The Nasdaq Composite Index consists of 210 data, which constitute the input–output data pairs of the 206 groups. The first 126 groups are used to design the intelligent system, and after 80 groups are used to test the system. The steps of tuning fuzzy logical system parameters based on the Sect. 3.2 QPSO algorithm, set the maximum iteration N max = 200, α decreased linearly from 2 to 1.5, the number of particles are 416. The initial particles are given as follows (Table 1).

Table 1 Initial particles of three fuzzy logic systems for forecasting the Nasdaq Composite Index

Using the previously designed QPSO algorithm to tune these initial particles, the QPSO algorithm training output and the actual output of the system are shown in Figs. 23 and 4. It shows that the tracking effect is very good. The after 80 groups are used to test the performance of the designed system, tracking results are shown in Figs. 56 and 7.

Fig. 2
figure 2

Results of training data for A1–C1

Fig. 3
figure 3

Results of training data for A2–C0

Fig. 4
figure 4

Results of training data for A2–C1

Fig. 5
figure 5

Results of testing data for A1–C1

Fig. 6
figure 6

Results of testing data for A2–C0

Fig. 7
figure 7

Results of testing data for A2–C1

Using the same system structure, Gaussian membership function, singleton fuzzifier, product inference and the same number of rules, BP algorithm is used for training and testing. Comparison of BP and QPSO algorithm, Figs. 23456 and 7 are the training and tracking performance of the two algorithms, respectively.

After 200 iterations, the RMSE of the two algorithms are obtained. The training errors and testing errors of QPSO and BP algorithms are shown in Tables 2 and 3.

Table 2 The training errors of QPSO and BP algorithms
Table 3 The testing errors of QPSO and BP algorithms

It can be seen from Figs. 23456 and 7 and Tables 23, it is better to use the QPSO algorithm than the BP algorithm to tune the parameters of the fuzzy logic system, and the RMSE of QPSO algorithm is relatively small. It shows that the design of fuzzy logic system based on QPSO algorithm is effective and feasible.

4.2 The Application of System Model in Prediction of the International Gold Prices

Gold is a special article with both commodity attribute and currency attribute, so the International Gold Prices will affect the global gold market. Due to the impact of the global economy, the International Gold Prices fluctuate every day, including the opening price, the middle price and closing price. In this example, the International Gold Prices were selected from January 1, 2015, to November 30, 2015, a total of 237 data. Using Matlab to draw the 237 data of the noiseless sequence diagram is shown in Fig. 8.

Fig. 8
figure 8

The diagram of International Gold Prices

In this paper, we use the first three data to predict the next data, that is, three inputs X = (x 1x 2x 3)T and one output y ∊ Y. In the fuzzy logic system, the rule’s antecedent is the Gaussian membership function. The fuzzy logic system is designed by using singleton fuzzifier, product inference. Set the number of rules M = 8, the kth rules of the three fuzzy logic systems are as follows:

$$\begin{aligned} & R^{k}{:}\,\quad {\text{IF}}\quad x_{1} \,{\text{is}}\,F_{1}^{k} \quad {\text{and}}\quad x_{2} \,{\text{is}}\,F_{2}^{k} \quad {\text{and}}\quad x_{3} \,{\text{is}}\,F_{3}^{k} , \\ & {\text{THEN}}\,Y^{k} \,{\text{is}}\,C_{0}^{k} + C_{1}^{k} x_{1} + C_{2}^{k} x_{2} + C_{3}^{k} x_{3} \quad k = 1, \ldots ,8 \\ \end{aligned}$$

where F k1 F k2 F k3 are the membership functions of the antecedent, the type-1 fuzzy set. Y k is the consequent of the kth rule, C k0 C k1 , …, C k3 are type-1 fuzzy set of the consequent parameters. C k i  = [c k i  − s k i c k i  + s k i ] (i = 0, 1…, 3), c k i is the center of C k i , s k i is the span of C k i

$$\begin{aligned} & R^{k}{:}\,\quad {\text{IF}}\quad x_{1} \,{\text{is}}\,\tilde{F}_{1}^{k} \quad {\text{and}}\quad x_{2} \,{\text{is}}\,\tilde{F}_{2}^{k} \quad {\text{and}}\quad x_{3} \,{\text{is}}\,\tilde{F}_{3}^{k} , \\ & {\text{THEN}}\,Y^{k} \,{\text{is}}\,p_{0}^{k} + p_{1}^{k} x_{1} + p_{2}^{k} x_{2} + p_{3}^{k} x_{3} \quad k = 1, \ldots ,8 \\ \end{aligned}$$

where \(\tilde{F}_{1}^{k} ,\tilde{F}_{2}^{k} ,\tilde{F}_{3}^{k}\) are the membership functions of the antecedent, the interval type-2 fuzzy set. Y k is the consequent of the kth rule, p k0 p k1 , …, p k3 are the consequent parameters

$$\begin{aligned} & R^{k}{:}\,\quad {\text{IF}}\quad x_{1} \,{\text{is}}\,\tilde{F}_{1}^{k} \quad {\text{and}}\quad x_{2} \,{\text{is}}\,\tilde{F}_{2}^{k} \quad {\text{and}}\quad x_{3} \,{\text{is}}\,\tilde{F}_{3}^{k} , \\ & {\text{THEN}}\,Y^{k} \,{\text{is}}\,C_{0}^{k} + C_{1}^{k} x_{1} + C_{2}^{k} x_{2} + C_{3}^{k} x_{3} \quad k = 1, \ldots ,8 \\ \end{aligned}$$

where \(\tilde{F}_{1}^{k} ,\tilde{F}_{2}^{k} ,\tilde{F}_{3}^{k}\) are the membership functions of the antecedent, the interval type-2 fuzzy set. Y k is the consequent of the kth rule, C k0 C k1 , …, C k3 are type-1 fuzzy set of the consequent parameters.

The International Gold Prices consists of 237 data, which constitute the input–output data pairs of the 234 groups. The first 129 groups are used to design the intelligent system, and after 105 groups are used to test the system. The steps of tuning fuzzy logical system parameters based on the Sect. 3.2 QPSO algorithm, set the maximum iteration N max = 200, α decreased linearly from 2 to 1.7, the number of particles are 160. The initial particles are given as follows:

Using the previously designed QPSO algorithm to tune these initial particles, the QPSO algorithm training output and the actual output of the system are shown in Figs. 910 and 11. It shows that the tracking effect is very good. The after 105 groups are used to test the performance of the designed system, tracking results are shown in Figs. 1213 and 14.

Fig. 9
figure 9

Results of training data for A1–C1

Fig. 10
figure 10

Results of training data for A2–C0

Fig. 11
figure 11

Results of training data for A2–C1

Fig. 12
figure 12

Results of testing data for A1–C1

Fig. 13
figure 13

Results of testing data for A2–C0

Fig. 14
figure 14

Results of testing data for A2–C1

Using the same system structure, Gaussian membership function, singleton fuzzifier, product inference and the same number of rules, BP algorithm is used for training and testing. Comparison of BP and QPSO algorithm, Figs. 910111213 and 14 are the training and tracking performance of the two algorithms, respectively (Table 4).

Table 4 Initial particles of three fuzzy logic systems for forecasting the International Gold Prices

After 200 iterations, the RMSE of the two algorithms are obtained. The training errors and testing errors of QPSO and BP algorithms are shown in Tables 5 and 6.

Table 5 The training errors of QPSO and BP algorithms
Table 6 The testing errors of QPSO and BP algorithms

It can be seen from Figs. 910111213 and 14 and Tables 56, it is better to use the QPSO algorithm than the BP algorithm to tune the parameters of the fuzzy logic system, and the RMSE of QPSO algorithm is relatively small. It shows that the design of fuzzy logic system based on QPSO algorithm is effective and feasible.

4.3 Performance Comparison of Fuzzy Logic Systems

Design the Intelligent system based on the 4.1 and 4.2. Using the same system structure, Gaussian membership function, singleton fuzzifier, product inference and the same number of rules. The design of Type-1, A1–C1, A2–C0 and A2–C1 intelligent system is applied in the prediction of the Nasdaq Composite Index and the International Gold Prices, the training output and the actual output of the system are shown in Figs. 15 and 16. The testing output and the actual output of the system are shown in Figs. 17 and 18.

Fig. 15
figure 15

The contrast result of training in Nasdaq Composite Index

Fig. 16
figure 16

The contrast result of training in International Gold Prices

Fig. 17
figure 17

The contrast result of testing in Nasdaq Composite Index

Fig. 18
figure 18

The contrast result of testing in International Gold Prices

After 200 iterations, the RMSE of the four fuzzy logic systems are obtained. The training errors and testing errors of QPSO algorithms are shown in Tables 7 and 8.

Table 7 RMSE of the International Gold Prices
Table 8 RMSE of the Nasdaq Composite Index

It can be seen from Figs. 151617 and 18 and Tables 78, the effect of A2–C1 fuzzy logic system is better than that of the other three fuzzy logic systems, and the RMSE of QPSO algorithm is relatively small. It shows that in the interval type-2 TSK fuzzy logic system, the more parameters are adjustable, the more accurate the test results.

5 Conclusions

Because of the wide application of fuzzy logic system, it is very important to study the optimization algorithm of fuzzy logic system. The type-2 fuzzy logic can deal with the uncertainty in the language and reduce the uncertainty in the system, so this paper is proposed interval type-2 fuzzy logic system based on QPSO intelligent algorithm to tune the system parameters. The design of intelligent system is applied in the prediction of the Nasdaq Composite Index and the International Gold Prices, the simulation is given. By comparing the performance of QPSO and BP algorithm, the performance index and the simulation results show that the QPSO algorithm is better than the BP algorithm to tune the parameters of the fuzzy logic system. By comparing the performance of four fuzzy logic systems, it shows that the effect of A2–C1 fuzzy logic system is better than that of the other three fuzzy logic systems.

So many interesting works still lie ahead, including the researching on designing Mamdani interval type-2 fuzzy logic systems, general type-2 fuzzy logic systems, and neural network optimized by other global searching algorithms. Future studies will be concentrated on hybrid systems design, algorithms, and applications.