이글루스 | 로그인
메뉴릿
카테고리
전체
공지사항
계획
Languages
Humanities
Mathematics
Education
Economics
Computers
HCI
Media
Engineering
Natural Science
TmaxSoft
BluemoonSoft
미분류
최근 등록된 덧글
짝짝짝 올 많이 컸네 일구
by izeye at 11/12
제가 갖고 있는 소스 파일..
by 언제나19 at 10/17
우왕 고맙습니다~~. ..
by 언제나19 at 10/16
http://nethack.byus..
by uriel at 10/16
근본적으로 activation ..
by uriel at 10/16
다운 안되는데여;;;;;
by 강병진 at 10/14
일단, 형변환 자체가 ..
by uriel at 04/11
어제는 괜히 xfix 실행..
by 언제나19 at 01/18
좀 기다리세요. 내년 4..
by 언제나19 at 11/04
바꾸어라.. 언제나19-..
by kang at 11/03
최근 등록된 트랙백
textcube를 다시 설치
by 공부가 본업.
gnuplot을 c 함수로 ..
by 상품 + 글 의견 남기기
gsl, gnu scientific li..
by 상품 + 글 의견 남기기
ubuntu, ati에서 dual..
by 상품 + 글 의견 남기기
Data browser로 sql d..
by 공부가 본업.
근황
by Yi jeon goo
근황
by Yi jeon goo
라이프로그
화려한 휴가
화려한 휴가

좋지 아니한가
좋지 아니한가

300
300

포토로그

언제나19의 포토로그
메모장 실험
메모장도 로그가 남나 실험
이전블로그
more...
이글루링크
◈ ◈ ◈ 바다가 머무는 ..
Mono log
Liard's newspaper
Yochin의 대전생활.
M log
art.oriented
* Sea of Blue *
이글루 파인더
rss

skin by 狂風
gsl + gnuplot_i

Regression Success!
with least square fitting
with gnu scientific library

1. random number generation with gsl
gsl_rng_env_setup();
rngtype = gsl_rng_default;
rng = gsl_rng_alloc(rngtype);
y[i] = x[i] + 3.0 * gsl_rng_uniform(rng);
REF: Random Number Generator Examples

2. gnuplot_plot_xy()

3. gsl_fit_linear()

Further information are in code below.
Basics are in trackbacks below.



always19@always19-desktop:~/project/SystemMonitor/gnuplot_i-2.10/test$ gcc -o drawlsf19 drawlsf19.c ../gnuplot_i.o -lgsl -lm -lgslcblas -L"/usr/lib" -I"../src"



#include <stdio.h>
#include "gnuplot_i.h"

#include <gsl/gsl_fit.h>
#include <gsl/gsl_rng.h>


#define NUM_SAMPLES 50

int
main(void)
{
double x[NUM_SAMPLES];
double y[NUM_SAMPLES];

const gsl_rng_type *rngtype;
gsl_rng * rng;

gnuplot_ctrl *h1;


int i;
double c0, c1, cov00, cov01, cov11, chisq;

gsl_rng_env_setup();
h1 = gnuplot_init();
gnuplot_setstyle(h1, "points");

rngtype = gsl_rng_default;
rng = gsl_rng_alloc(rngtype);

for (i = 0; i < NUM_SAMPLES ; i++)
{
double u = gsl_rng_uniform (rng);
x[i] = i ;
y[i] = x[i] + 3.0 * u;
}

gsl_fit_linear(x, 1, y, 1, NUM_SAMPLES, &c0, &c1, &cov00, &cov01, &cov11, &chisq);

gnuplot_plot_xy(h1, x, y, NUM_SAMPLES, "linear");

gnuplot_setstyle(h1, "lines");
gnuplot_plot_slope(h1, c1, c0, "regression");
gnuplot_plot_slope(h1, 1.0, 0.0, "slope");

getchar();

gnuplot_close(h1);

gsl_rng_free(rng);
return 0;
}

by 언제나19 | 2008/10/12 21:11 | Computers | 트랙백(2) | 덧글(0)
트랙백 주소 : http://always19.egloos.com/tb/2089895
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]
Tracked from 상품 + 글 의견 남기기 at 2008/10/12 21:12

제목 : gsl, gnu scientific library
I was looking for a library to handle a regression method. Fitting Overview,I found two, gretl and gsl.gretl contains a gui. But I decided to use a gsl since it look more famous and general.Ubuntu......more

Tracked from 상품 + 글 의견 남기기 at 2008/10/12 21:13

제목 : gnuplot을 c 함수로 써봤다. gnuplot_..
그래프를 그려보고 싶어서, gnuplot을 써봤다. http://www.gnuplot.info/command 를 몇 줄만 입력하면, 멋있는 그래프를 볼 수 있다.c 함수에서 직접 실행시키고 싶어서,google에서 "c gnuplot interface"를 찾......more

:         :

:

비공개 덧글


◀ 이전 페이지 다음 페이지 ▶