我想用 R 绘制这样的图:
该图的 x 轴应该从 10 开始,但我们的数据是从 40 开始。 这是我们的数据:
x_values <- c(40, 41, 42, 44, 45, 46, 48, 49, 51, 53, 54, 56, 58, 59, 61, 63, 65, 67, 69, 71, 73, 76, 78, 80, 83, 85, 88, 91, 94, 96, 99, 102, 106, 109, 112, 116, 119, 123, 127, 131, 135, 139, 143, 148, 152, 157, 162, 167, 172, 177, 183, 188, 194, 200, 206, 213, 219, 226, 233, 240, 247, 255, 263, 271, 279, 288, 297, 306, 316, 325, 335, 346, 356, 367, 379, 390, 402, 415, 428, 441, 454, 468, 483, 498, 513, 529, 545, 562, 580, 597, 616, 635, 654, 675, 696, 717, 739, 762, 785, 810)
y_values <- c(629.6425092, 693.9067558, 754.4664563, 767.5637544, 808.2602174, 794.0798188, 827.8263105, 829.0713063, 942.1401253, 941.4504438, 977.2613896, 988.3319533, 1065.3184551, 1153.8098881, 1141.3217309, 1162.6235085, 1170.0284627, 1176.2804890, 1147.8923481, 1195.5306605, 1179.2821602, 1164.1645349, 1113.1920617, 991.4336153, 1016.4254102, 954.4010424, 942.3961786, 1131.3566435, 1053.4404436, 872.8857897, 741.2625489, 669.3430698, 605.0944916, 593.7124494, 580.5191216, 565.4610143, 549.2083824, 478.9347173, 509.6879804, 328.7164120, 332.8948846, 284.6312054, 280.7722786, 335.8359343, 243.1869010, 268.7471464, 230.1890039, 200.0794310, 222.2806710, 164.0873158, 131.3721738, 112.6710788, 100.8907618, 95.8925401, 77.1103902, 67.2195979, 60.7203287, 54.2668605, 45.4695630, 40.1307280, 35.3640275, 33.1294568, 30.3855069, 25.3479543, 22.4857722, 20.4963634, 19.1942742, 16.0412082, 11.7917180, 11.3206729, 8.9647115, 8.8772804, 7.9883784, 6.5044297, 5.7742390, 4.9888767, 4.3245790, 3.8242901, 3.2763016, 2.8762140, 2.5361281, 2.2526347, 1.9660910, 1.6893935, 1.5069924, 1.3296613, 1.1608268, 1.0178425, 0.9470220, 0.8378081, 0.6925257, 0.6426677, 0.5678900, 0.5064849, 0.4364656, 0.3848985, 0.3521381, 0.3600632, 0.1613892, 0.0000000)
Opt <- data.frame(Diam = x_values, dN = y_values)
我尝试使用 nls()、GauPro() 等来绘制它,但我希望通过对数正态拟合获得建模线,以及像高斯或对数正态拟合这样的干净方程。
我尝试使用 nls()、GauPro() 等来绘制它,但我希望通过对数正态拟合获得建模线,以及像高斯或对数正态拟合这样的干净方程。 我的尝试结果是红线,但我想要一条蓝线,如下所示:
另外,我尝试直接制作一个对数正态函数,如下所示:
yc <- which(Opt$dN == max(Opt$dN))
yc_1 <- Opt$Diam[yc]
yc_2 <- Opt$dN[yc]/2
dNDiff <- abs(Opt$dN - yc_2)
HalfPoint <- which(dNDiff == min(dNDiff))
w1 <- Opt$Diam[HalfPoint]
FWHM = abs(w1 - yc_1)*2
realW = FWHM/sqrt(log(2))
Area = Opt$dN[yc] * 2 * (realW/2) * sqrt(pi/2)
Input <- seq(0,100, by=0.1)
FinalList = 0 + ( Area / ( realW * sqrt(pi/2) ) ) * exp( -2 * (Input - yc_1)^2 / realW^2 )
#plot(Opt$Diam, Opt$dN, log="x", xlim=c(10,1000))
#par(new=T)
plot(Input, FinalList)
但是,看起来很奇怪,类似于上面使用 nls() 的情况。
你们能帮我吗