1
저는 R의 퍼지 세트 기능을 사용하여 this example을 구현하려고합니다. 코드 : 나는 조금 난처한 상황에 빠진거야R 퍼지 세트 - 퍼지 멀티 세트의 튜플을 그릴 수 없습니다.
> plot(system)
Error in lines.tuple(as.tuple(x), ...) :
Cannot plot tuple of fuzzy multisets.
> fi <- fuzzy_inference(system, list(temp=80))
Error in rep.int(0, len - length(ret)) : invalid 'times' value
: 나는 그러나 그것을 실행하면
sets_options("universe", seq(from = -200, to = 200, by = 1))
#------------------------------------------------------------------------------------------
# Fuzzy Variables
variables <-
set (
temp = fuzzy_variable(cold = fuzzy_trapezoid(corners=c(-101, -100, 40, 70)),
ok = fuzzy_triangular(corners=c(40,70,100)),
hot = fuzzy_trapezoid(corners=c(70, 100, 200, 201))),
ctrl = fuzzy_variable(small = fuzzy_triangular(corners=c(-50,0,50)),
med = fuzzy_triangular(corners=c(0, 50, 100)),
large = fuzzy_triangular(corners=c(50, 100, 150)))
)
#------------------------------------------------------------------------------------------
# Fuzzy Rules
rules <-
set(
fuzzy_rule(temp %is% cold, ctrl %is% large),
fuzzy_rule(temp %is% ok, ctrl %is% med),
fuzzy_rule(temp %is% hot, ctrl %is% small)
)
#------------------------------------------------------------------------------------------
# Set up Fuzzy System
system <- fuzzy_system(variables, rules)
print(system)
plot(system)
#------------------------------------------------------------------------------------------
# Example
# If the measured temperature is 80 degrees, what's the control effort?
fi <- fuzzy_inference(system, list(temp=80))
## plot resulting fuzzy set
plot(fi)
## defuzzify
gset_defuzzify(fi, "centroid")
## reset universe
sets_options("universe", NULL)
, 나는 두 가지 오류를 얻을. 비슷한 문제인 것처럼 보이는 this을 찾았지만 위의 오타를 볼 수 없습니다.
도움을 주시면 감사하겠습니다. 감사. 문제가 생길 경우 Windows에서 R v3.2.4를 사용하십시오.
필요 없음. 삭제할 수 있습니다. –