ホーム  •  ニュース  •  フォーラム  •  アカウント情報  •  サイト内検索  •  新規登録
 ログイン
ユーザ名:

パスワード:


パスワード紛失

新規登録
 カウントダウンブロック
カウントダウンイベントはありません
 メニュー

メイン
   地球科学のための R
     Prof. Lindzen's Lecture : Smooth Approximation
投稿するにはまず登録を

スレッド表示 | 新しいものから 前のトピック | 次のトピック | 下へ
投稿者 スレッド
投稿日時: 2006-4-27 16:28
登録日: 2004-7-29
居住地: 地球
投稿: 303
Prof. Lindzen's Lecture : Smooth Approximation
同じく、課題のひとつ。discrete に与えられたデータから、なめらかな関数をつくる。
################################################
#
# Make a smooth function for a given gradient values
#
################################################
cleanerfun <- function(x, y0, Corz, Grad){
  val <- y0 + Grad[1] * x
  for( i in 2:(length(Corz)-1)){
    delta <- Corz[i+1] - Corz[i]
    buff  <- ( Grad[i] - Grad[i-1] ) / 2 * ( delta * log( 2 * cosh(( x - Corz[i] )/delta)) + x - Corz[i])
    val   <- val + buff
  }
  return( val )
}
ここで、

# x : データの値がほしい x 座標
# y0 : x[1] におけるデータの値
# Corz: データの値の傾きを与える点の座標
# Grad: 上記座標でのデータの値の傾き
投稿日時: 2006-4-27 16:35
登録日: 2004-7-29
居住地: 地球
投稿: 303
Re: Prof. Lindzen's Lecture : Smooth Approximation
実行例:
上記関数を定義した後、
#
# Examples : give gradient varlues
#
# Delta: 傾きを与える点の間隔
# Corz: 傾きを与える点の座標
# Grad: 上記座標での傾き
#
Delta  <- 0.1
Corz   <- seq(0,10,Delta)+Delta/2
Grad   <- -sin(Corz)

#
# Examples : calculate the value
#
x      <- seq(0,10,0.01)
result <- cleanerfun(x, 1, Corz, Grad)
plot(x, result)
スレッド表示 | 新しいものから 前のトピック | 次のトピック | トップ

投稿するにはまず登録を
 


WWW を検索 meteorology.jp を検索

Powered by XOOPS 2.0 © 2001-2006 The XOOPS Project, Maitained by A. Mori
FI Theme :: XOOPS 2 Theme by ImageSquare :: Costomized by matchan and A.Mori