seg1 <- function(t) 0.01000000+0.01021486*t+0.00915602*t^2-0.01485179*t^3
curve(seg1, 0, 2/12)
seg2 <- function(t) 0.01145666+0.00758914*t+0.01521279*t^2+0.09378380*t^3
curve(seg2, 2/12, 5/12)
seg3 <- function(t) 0.00000000+0.02320514*t+0.00490835*t^2-0.08080547*t^3
curve(seg3, 5/12, 11/12)
seg4 <- function(t) 0.02215231-0.02425796*t-0.00962054*t^2+0.02154812*t^3
curve(seg4, 11/12, 15/12)
加入使用相同的比例在相同的圖中的4個片段,用間隔從0到1.25如何在同一圖表上繪製多條曲線段?
我的原單輸入不正確。 使用正確的輸入我得到的平滑曲線
SEG1 < - 函數(t)的0.0100000000000000 + 0.01145665803921569 * T + 0.02215231058823505 * T^3 曲線(SEG1,0,2/12,XLIM = C(0 ,1.25),ylim = C( - 1,0.1))
SEG2 < - 函數(t)的0.0102148623819898 + 0.00758913516339875 * T + 0.02320513725490168 * T^2 - 0.02425796392156832 * T^3 曲線(SEG2,2/12,5/12,add = TRUE)
seg3 < - function(t)0.0091560208106391 + 0.01521279447712401 * t + 0.00490835490196105 * T^2 - 0.00962053803921581 * T^3 曲線(SEG3,5/12,11/12,添加= TRUE)
SEG4 < - 函數(t)的-0.0148517859681374 + 0.09378379848039248 * T - 0.08080546764705908 * T^2 + 0.02154812470588242 * T^3 曲線(SEG4,11/12,15/12,添加= TRUE)
愛你這麼多! –
我可以繪製x =(0,2/2,5/12,11/12,15/12)的對應seg(x)點和值嗎? –
聽起來就像你要麼在曲線上加'points',要麼在所有'curve'函數中傳入'type ='p'(points)或'type ='b''(點和線)參數,但我不完全清楚。 – Thomas