Integrate()、Interpolate() 和 SplineEval()
將 Integrate 與 Interpolate 或 SplineEval 結合使用以獲得曲線下的面積。
@塞利格曼寫道使用 JMP 求曲線下面積;這裡有一些關於一些內置函數的更多信息。
Interpolate 函數使用 X 坐標的排序列表和相應的 Y 坐標列表,並回答“如果 X 為 42,Y 會是多少?”的問題。在排序列表中最近的兩個 X 坐標之間使用線性插值。 線性插值產生直線段,數據點位於曲線的拐角處。
SplineEval 函數使用樣條插值執行相同的操作(在 Spline Coef 函數的幫助下)。 樣條線是一種靈活的、有彈性的金屬線,它靠近數據點,具體取決於它的硬度。 通常數據點不會落在樣條曲線上。
這兩個函數都會生成曲線中從第一個 X 到最後一個 X 的所有數據點。
積分函數回答了另一個問題:“在此範圍內,該曲線下方有多少面積?” Interpolate 有四個參數;前兩個描述生成曲線的 af(x) 函數,後兩個描述 x 值的範圍。 Integrate( f(x), x, low, high ) 的結果是 x 從低到高時曲線下的面積。 前兩個變量似乎重複 x,因為 f(x) 可能是像 a+2*b 這樣的表達式,第二個變量告訴我們 a 或 b 是否是 low 和 high 之間的變量。
這篇文章的 JSL 是關於使用 Interpolate 或 SplineEval 作為 Interpolate 的 f(x) 值。它構建了一個交互式圖表,以幫助理解如何使用線性或樣條插值來查找由某些噪聲數據點定義的曲線下的面積。 它還顯示了將噪聲(黑色數據點)添加到數據之前的確切答案(紅色)。 藍色曲線是黑色數據點的樣條擬合。 中間的條形圖並排顯示了三個面積計算;當樣條張力發生變化時,只有中間的藍色條會移動。 有了正確的隨機數據,任何條形都可以比其他條形更高或更短。
JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL製作了這樣一個圖表; lambda 滑塊改變藍色樣條線的張力。
每個...都需要 JMP 16
New Window( "Integrate Area Under Curve",
// make a function, in the window: namespace, that returns a sine wave
window:f = Function( {t},
50 + Sin( t / 10 ) * 40
);
// create the x dimension of the graph
window:xmin = 20; // integrate over this range
window:xmax = 80;
window:xcoarse = window:xmin :: window:xmax :: 4; // the coarse data is used to make random data from sin function
window:xfine = window:xmin :: window:xmax :: 0.125; // the fine data is used for outlining smooth polygons
// create the y dimension of the graph from x and function f(x) and some randomness
window:random = 10; // random variation, slider below
// this function called here, and from slider below
window:generatedata = Function( {}, // regenerate the points with new random error
window:ycoarse = window:f( window:xcoarse ) + J( 1, N Col( window:xcoarse ), Random Normal( 0, window:random ) );
// ycoarse is the y data for the points; limit it to stay on the y axis...
window:ycoarse[Loc( window:ycoarse > 99 )] = 99;
window:ycoarse[Loc( window:ycoarse < 1 )] = 1;
);
window:generatedata(); // prepare the initial data in the graph
// lambda is the tension on the spline interpolation, slider below
window:loglambda = 2;// spline tension, a nice middle value
// random patterns for filled areas. the exponents are artistically adjusted for blending the colors
// with gray drawn first, and dark, and yellow drawn last, medium, and blue between, but light.
// there are 7 overlaps with different shades.
window:patternsize = 299; // big square patch for a pattern
window:pat01 = J( window:patternsize, window:patternsize, (Random Integer( 0, 255 ) / 255) ^ 0.5 );//gray
window:pat02 = J( window:patternsize, window:patternsize, (Random Integer( 0, 255 ) / 255) ^ 3 );//blue
window:pat03 = J( window:patternsize, window:patternsize, (Random Integer( 0, 255 ) / 255) ^ 2 );//yellow
window:bar01 = 38;
window:bar02 = 44;// bar x-locations, in graph coordinates; they look good here, for this sine wave
window:bar03 = 50;
window:show = [1 1 1];
window:barwide = 5;
window:barbottom = 50;// bottom of chopped off bar
window:bartop = window:barbottom + 5;
// map values of the AUC onto the graph
window:aucMin = 1500;
window:aucMax = 4000;
window:aucToGraph = Function( {y}, // convert auc to graph Y to make bar heights; 0 is for a label
Interpolate( y, 0, window:barbottom - window:bartop, window:aucMin, 7, window:aucMax, 97 - window:bartop )
);
// draw a broken bar; x in graph units, y in auc units
window:drawAucBar = Function( {x, y},
y = window:aucToGraph( y );
Polygon(// ragged edge bottom poly below the break
x || x || x + .1 * window:barwide || x + .3 * window:barwide || x + .5 * window:barwide || x + .8 * window:barwide || x + window:barwide
|| x + window:barwide,
window:barbottom || window:barbottom + 5 || window:barbottom + 6 || window:barbottom + 4 || window:barbottom + 7 || window:barbottom + 3
|| window:barbottom + 5 || window:barbottom
);
If( y >= 0, // the bar is below the break, don't draw
Polygon(
x || x || x + .1 * window:barwide || x + .3 * window:barwide || x + .5 * window:barwide || x + .8 * window:barwide || x + window
:barwide || x + window:barwide,
window:bartop + y || window:bartop + 5 || window:bartop + 6 || window:bartop + 4 || window:bartop + 7 || window:bartop + 3 || window
:bartop + 5 || window:bartop + y
)
);
);
// make the GUI
window:g = Graph Box(
// this script runs when the graph needs to reshow, either the first time, or because a slider script uses <<RESHOW framesize=""></RESHOW>

將 Integrate 與 Interpolate 或 SplineEval 結合使用以獲得曲線下的面積。
回复:Integrate()、Interpolate() 和 SplineEval()謝謝! 我發現,如果我正在尋找的話,即使是 99x99 的隨機正方形也會產生可見的平鋪邊緣。 在 299x299 時我不再看到它。
最後我添加了不帶參數的 fillpattern() ,希望它能清除模式。 看來是的。 如果沒有它,圓形數據點就會被填滿,這是我真正沒想到的。 由於交叉線圖案稀疏,數據點大多不會顯示。 我想這是一個特點。
Big filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markersBig filled diamond and filled circle markers大實心菱形和實心圓形標記
p = J( 128, 128, . );
Parallel Assign( {}, p[r( -20, 20 ), c( -20, 20 )] = (Sin( r ) * Sin( c ) + 1) / 2 );
New Window( "bumps",
Graph Box(
<<MARKER size=""></MARKER>回复:Integrate()、Interpolate() 和 SplineEval()
Fill Pattern()
好的!
New Window( "window",
Graph Box(
framesize( 1000, 900 ),
Y Scale( 0, 900 ),
X Scale( 0, 1000 ),
for (i=1,i<=89,i++,
pattSize = i;
pen color(black);
pen size (2);
y1 = floor(i/10)*100;
x1 = mod(i,10)*100;
Rect( mod(i,10)*100, (floor(i/10))*100+i, (mod(i,10))*100+i, floor(i/10)*100);
Fill Color( "dark blue" );
Fill Pattern( J( pattsize, pattsize, (Random Integer( 0, 255 ) / 255) ) );
Rect( mod(i,10)*100, (floor(i/10)+1)*100-10, (mod(i,10)+1)*100-10, floor(i/10)*100, 1 );
)
)
);

回复:Integrate()、Interpolate() 和 SplineEval()新版本只有一個圖案和一個用於調整圖案大小的滑塊。
注意:連續重新生成模式新版本的簡單方法:調整窗口大小:)
有趣的:
圖錶框的網格似乎在“實時”模式下可見 - 作為靜態網格與變化模式的隨機噪聲。
如果我凍結屏幕(不調整窗口大小) - 網格就會“消失”。
對你來說也是如此嗎?

Names default to here(1);
New Window( "window",
V List Box(
window:i = 1;
Slider Box( 1,300, window:i, window:gb << reshow ),
window:gb = Graph Box(
framesize( 600, 600 ),
Y Scale( 0, 600 ),
X Scale( 0, 600 ),
window:pattSize = i;
Fill Color( "dark blue" );
mat= J( window:pattsize, window:pattsize, (Random Integer( 0, 255 ) / 255) );
//mat=J( pattsize, pattsize, 0 );
Fill Pattern( mat );
Rect( 0, 600, 600, 300, 1 );
mat[0,window:pattsize]=J(window:pattsize,1,1);
mat[window:pattsize,0]=J(1,window:pattsize,1);
Fill Pattern( mat );
Rect( 0, 300, 600, 0, 1 );
Text Size( 50 );
Text( {270, 270}, Char(floor(i) ) );
);
)
);