Skip to main content
. 2023 Aug 9;9:e1506. doi: 10.7717/peerj-cs.1506
Algorithm 1. A cloud model similarity metric algorithm based on EW-type closeness and cloud droplet variance. (MATLAB)
Input: Two sets of cloud models: Ci(ExiEniHei) and Cj(ExjEnjHej).
Output: The SimEPTCM of the two sets of cloud models.
1  function [EPTCM] = EPTCM(PO,PN)
2  z = 1;
3  t = 1;
4  Ex1 =PO(1);
5  En1 =PO(2);
6  He1 =PO(3);
7  Ex2 =PN(1);
8  En2 =PN(2);
9  He2 =PN(3);
%The two sets of cloud model expectation curves are expressed in the form of triangular fuzzy numbers.
10  symsr;
11  ux1 = Ex1 − 3∗En1∗(1 − r);
12  us1 = Ex1 + 3∗En1∗(1 − r);
13  ux2 = Ex2 − 3∗En2∗(1 − r);
14  us2 = Ex2 + 3∗En2∗(1 − r);
% The expectation values E (u) and E (v) and the widths W (u) and W (v) of the two triangular blurred numbers are calculated, respectively.
15  Eu1 = (ux1 + us1)/2;
16  Eu2 = (ux2 + us2)/2;
17  Wu1 = (us1 − ux1)/2;
18  Wu2 = (us2 − ux2)/2;
% Calculate the difference between the expected value (ΔE) of the two triangular cloud models, and the difference (ΔW) in width. Substitute into Eqs. (8) and (9) to obtain the interval number closeness (nEW(uv)).
19  N1=@r1/1+absEu1Eu2 ˆz+absWu1Wu2 ˆz/3 ˆ1/z ˆt;
% According to Eq. (15), the obtained interval number closeness (nEW(uv)) is converted to EW-type closeness. That is Sim (ETCM).
20  ETCM = int(N1, r, 0, 1);
21  eval(ETCM);
% Calculate the mean variance of the two sets of cloud models. Calculate the distance similarity Sim (PCM) of two groups of cloud models by Eq. (16).
22  PCM=minsqrtEn1 ˆ2+He1 ˆ2,sqrtEn2 ˆ2+He2 ˆ2/maxsqrtEn1 ˆ2+He1 ˆ2,sqrtEn2 ˆ2+He2 ˆ2;
% Calculate the weight coefficients of ETCM and PCM methods by Eq. (17). The final EPTCM algorithm is obtained after the weighting calculation of the two. As shown in Eq. (18).
23  syms B;
24  [B] =solve((1-2*B) ˆ2-sqrt((ETCM-PCM) ˆ2) = =0);
25  B =vpa(B);
26  A =B(1);
27  if(A<B(2))
28      C =A;
29      A =B(2);
30      B =C;
31  end
32  EPTCM =A*ETCM+B*PCM;
33  eval(EPTCM);
34  end