<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />Ciao! Ho programmato una semplice media mobile, ma ho bisogno di lavorare sui dati (calcolare la variazione di pendenza), quindi voglio salvarlo su una tabella di dati. Ma come lo script?
Anche le idee su come calcolare la pendenza sono ben accette! Quello che sto pensando è semplicemente prendere la derivata come ritardo (ds / dt = (time-lag (time, x)) / (position-lag (position, x))

Jim, grazie, ha fatto il trucco
Nel frattempo ho calcolato manualmente, ma ora userò la soluzione di Jim. E JoseGL, ho usato la seguente formula che dovresti essere in grado di usare. Y Puoi usare Lag (: variabile, indice) per indicare l'indice di riga. è molto più flessibile in questo modo, perché puoi cambiare il contatore n con qualsiasi valore desiderato.

Nei miei dati, ho spesso bisogno di calcolare la pendenza di una piccola sezione di righe che si ripete ogni 200 righe in file con righe> 500K, e questo è il modo in cui di solito lo faccio:
1) Aggiungi un marker artificiale * [ad esempio, da 0 a 200] alla "serie di righe" usando una sequenza
* Chiamo questo tempo di misurazione variabile
2) Impostare la lunghezza delle medie X e Y per la formula dell'inclinazione
3) Utilizzare un'istruzione IF per stimare la pendenza dell'intervallo o delle righe che desidero
4) [Nei miei dati] Correggo tutte le misure con la pendenza
Questa è la sceneggiatura che uso [fortemente codificata, ma mi fa fare il lavoro ^ _ ^]
Y_Mean = Mean( :MA_T1[Row()], :MA_T1[Row() + 1], :MA_T1[Row() + 2], :MA_T1[Row() + 3], :MA_T1[Row() + 4], :MA_T1[Row() + 5], :MA_T1[Row() + 6], :MA_T1[Row() + 7], :MA_T1[Row() + 8], :MA_T1[Row() + 9], :MA_T1[Row() + 10], :MA_T1[Row() + 11], :MA_T1[Row() + 12], :MA_T1[Row() + 13], :MA_T1[Row() + 14] ); X_Mean = Mean( :Measurement time[Row()], :Measurement time[Row() + 1], :Measurement time[Row() + 2], :Measurement time[Row() + 3], :Measurement time[Row() + 4], :Measurement time[Row() + 5], :Measurement time[Row() + 6], :Measurement time[Row() + 7], :Measurement time[Row() + 8], :Measurement time[Row() + 9], :Measurement time[Row() + 10], :Measurement time[Row() + 11], :Measurement time[Row() + 12], :Measurement time[Row() + 13], :Measurement time[Row() + 14] ); If( :Measurement time == 1, Slope = ((:Measurement time[Row()] - X_Mean) * (:MA_T1[Row()] - Y_Mean) + (:Measurement time[Row() + 1] - X_Mean) * (:MA_T1[Row() + 1] - Y_Mean) + (:Measurement time[Row() + 2] - X_Mean) * (:MA_T1[Row() + 2] - Y_Mean) + (:Measurement time[Row() + 3] - X_Mean) * (:MA_T1[Row() + 3] - Y_Mean) + (:Measurement time[Row() + 4] - X_Mean) * (:MA_T1[Row() + 4] - Y_Mean) + (:Measurement time[Row() + 5] - X_Mean) * (:MA_T1[Row() + 5] - Y_Mean) + (:Measurement time[Row() + 6] - X_Mean) * (:MA_T1[Row() + 6] - Y_Mean) + ( :Measurement time[Row() + 7] - X_Mean) * (:MA_T1[Row() + 7] - Y_Mean) + (:Measurement time[Row() + 8] - X_Mean) * (:MA_T1[Row() + 8 ] - Y_Mean) + (:Measurement time[Row() + 9] - X_Mean) * (:MA_T1[Row() + 9] - Y_Mean) + (:Measurement time[Row() + 10] - X_Mean) * ( :MA_T1[Row() + 10] - Y_Mean) + (:Measurement time[Row() + 11] - X_Mean) * (:MA_T1[Row() + 11] - Y_Mean) + (:Measurement time[Row() + 12] - X_Mean) * (:MA_T1[Row() + 12] - Y_Mean) + (:Measurement time[Row() + 13] - X_Mean) * (:MA_T1[Row() + 13] - Y_Mean) + ( :Measurement time[Row() + 14] - X_Mean) * (:MA_T1[Row() + 14] - Y_Mean)) / ((:Measurement time[Row()] - X_Mean) ^ 2 + ( :Measurement time[Row() + 1] - X_Mean) ^ 2 + (:Measurement time[Row() + 2] - X_Mean) ^ 2 + (:Measurement time[Row() + 3] - X_Mean) ^ 2 + (:Measurement time[Row() + 4] - X_Mean ^ 2) + (:Measurement time[Row() + 5] - X_Mean) ^ 2 + (:Measurement time[Row() + 6] -X_Mean) ^ 2 + (:Measurement time[Row() + 7] - X_Mean) ^ 2 + (:Measurement time[Row() + 8] - X_Mean) ^ 2 + (:Measurement time[Row() + 9] - X_Mean) ^ 2 + (:Measurement time[Row() + 10] - X_Mean) ^ 2 + (:Measurement time[Row() + 11] - X_Mean) ^ 2 + ( :Measurement time[Row() + 12] - X_Mean) ^ 2 + (:Measurement time[Row() + 13] - X_Mean) ^ 2 + (:Measurement time[Row() + 14] -X_Mean) ^ 2) ); If( :Measurement time < 1, :MA_T1, :MA_T1 - Slope * :Measurement time );)
Spero che questo ti aiuti,
E se qualcuno sa come farlo, per favore fatemi sapere:

[cioè, pedice il [utente] -given nome di una variabile senza dover usare il nome effettivo della variabile]
-JoseGL
Ecco un semplice esempio tratto dall'indice ==> Scripting Index, per l'oggetto Time Series che illustra come salvare le medie mobili semplici in una tabella di dati in uno script.
Nomi predefiniti qui ( 1 ) ;
dt = Aperto ( "$ SAMPLE_DATA / Stock Prices.jmp" ) ;
obj = Serie storiche (
Y ( : Vicino ) ,
Semplice
Media mobile ( Aggiungi modello ( 5 ) )
) ;
resultdt = obj <<
Media mobile semplice ( Salva nella tabella dati ) ;
Non mi avventuro un'opinione sul calcolo della pendenza.