[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
9.1.15 Error sample

C++ code
mglData y(50,1), x0(10), y0(10), ex(10), ey(10); y.Modify("0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); x0.Modify("2*x-1 + 0.1*rnd-0.05"); y0.Modify("0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x) + 0.2*rnd-0.1"); ey.Modify("0.2"); ex.Modify("0.1"); gr->Box(); gr->Plot(y); gr->Error(x0,y0,ex,ey,"ko");
MGL code
new y 50 new x0 10 new y0 10 new ex 10 new ey 10 modify y '0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)' modify x0 '2*x-1 + 0.1*rnd-0.05' modify y0 '0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x) + 0.2*rnd-0.1' modify ey '0.2' modify ex '0.1' box plot y error x0 y0 ex ey 'ko'
Pure C code
HMDT y = mgl_create_data_size(50,1,1); HMDT x0 = mgl_create_data_size(10,1,1); HMDT y0 = mgl_create_data_size(10,1,1); HMDT ex = mgl_create_data_size(10,1,1); HMDT ey = mgl_create_data_size(10,1,1); mgl_data_modify(y,"0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)",0); mgl_data_modify(x0,"2*x-1 + 0.1*rnd-0.05",0); mgl_data_modify(y0,"0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x) + 0.2*rnd-0.1",0); mgl_data_modify(ey,"0.2",0); mgl_data_modify(ex,"0.1",0); mgl_box(gr,1); mgl_plot(gr,y,NULL); mgl_error_exy(gr,x0,y0,ex,ey,"ko"); mgl_delete_data(x0); mgl_delete_data(y0); mgl_delete_data(ex); mgl_delete_data(ey); mgl_delete_data(y);
Fortran code
integer y, x0, y0, ex, ey, mgl_create_data_size y = mgl_create_data_size(50,3,1) x0 = mgl_create_data_size(10,1,1) y0 = mgl_create_data_size(10,1,1) ex = mgl_create_data_size(10,1,1) ey = mgl_create_data_size(10,1,1) call mgl_data_modify(y,'0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + 0.2*sin(pi*x)',0) call mgl_data_modify(x0,'2*x-1 + 0.1*rnd-0.05',0); call mgl_data_modify(y0,'0.7*sin(2*pi*x) + 0.5*cos(3*pi*x) + & 0.2*sin(pi*x) + 0.2*rnd-0.1',0); call mgl_data_modify(ey,'0.2',0) call mgl_data_modify(ex,'0.1',0); call mgl_box(gr,1) call mgl_plot(gr,y,'') call mgl_error_exy(gr,x0,y0,ex,ey,'ko') call mgl_delete_data(x0) call mgl_delete_data(y0) call mgl_delete_data(ex) call mgl_delete_data(ey) call mgl_delete_data(y)
Python
y, x0, y0, ex, ey = mglData(50,1), mglData(10), mglData(10), mglData(10), mglData(10); y.Modify("0.7*sin(2*pi*x)+0.5*cos(3*pi*x)+0.2*sin(pi*x)",0); x0.Modify("2*x-1+0.1*rnd-0.05"); y0.Modify("0.7*sin(2*pi*x)+0.5*cos(3*pi*x)+0.2*sin(pi*x)+0.2*rnd-0.1"); ey.Modify("0.2"); ex.Modify("0.1"); gr.Box(); gr.Plot(y); gr.Error(x0,y0,ex,ey,"ko");
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |