0

给定一组 (x,y) 坐标,我如何从 y 求解 x。如果要绘制坐标,它们将是非线性的,但非常接近指数。我试过approx()了,但它很遥远。这是示例数据。在这种情况下,我该如何解决y == 50

  V1      V3

1 5.35 11.7906

2 10.70 15.0451

3 16.05 19.4243

4 21.40 20.7885

5 26.75 22.0584

6 32.10 25.4367

7 37.45 28.6701

8 42.80 30.7500

9 48.15 34.5084

10 53.50 37.0096

11 58.85 39.3423

12 64.20 41.5023

13 69.55 43.4599

14 74.90 44.7299

15 80.25 46.5738

16 85.60 47.7548

17 90.95 49.9749

18 96.30 51.0331

19 101.65 52.0207

20 107.00 52.9781

21 112.35 53.8730

22 117.70 54.2907

23 123.05 56.3025

24 128.40 56.6949

25 133.75 57.0830

26 139.10 58.5051

27 144.45 59.1440

28 149.80 60.0687

29 155.15 60.6627

30 160.50 61.2313

31 165.85 61.7748

32 171.20 62.5587

33 176.55 63.2684

34 181.90 63.7085

35 187.25 64.0788

36 192.60 64.5807

37 197.95 65.2233

38 203.30 65.5331

39 208.65 66.1200

40 214.00 66.6208

41 219.35 67.1952

42 224.70 67.5270

43 230.05 68.0175

44 235.40 68.3869

45 240.75 68.7485

46 246.10 69.1878

47 251.45 69.3980

48 256.80 69.5899

49 262.15 69.7382

50 267.50 69.7693

51 272.85 69.7693

52 278.20 69.7693

53 283.55 69.7693

54 288.90 69.7693

4

1 回答 1

2

我想您遇到的问题是approx解决给y定的问题x,而您正在谈论解决给x定的问题y。所以你需要切换你的变量xy使用时approx

df <- read.table(textConnection("

V1      V3
85.60 47.7548
90.95 49.9749
96.30 51.0331
101.65 52.0207

"), header = TRUE)

approx(x = df$V3, y = df$V1, xout = 50)
# $x
# [1] 50
# 
# $y
# [1] 91.0769

此外,如果y相对于 是指数的,那么在和x之间存在线性关系,因此在和之间使用线性插值器更有意义,然后取指数返回:xlog(y)xlog(y)y

exp(approx(x = df$V3, y = log(df$V1), xout = 50)$y)
# [1] 91.07339
于 2012-07-22T04:55:49.773 回答