From: <be...@us...> - 2012-07-12 05:03:42
|
Revision: 10742 http://octave.svn.sourceforge.net/octave/?rev=10742&view=rev Author: benjf5 Date: 2012-07-12 05:03:35 +0000 (Thu, 12 Jul 2012) Log Message: ----------- Fixed o18.csv (had the wrong data before) and added the beginning of a demonstration script. Modified Paths: -------------- trunk/octave-forge/extra/lssa/data/o18.csv trunk/octave-forge/extra/lssa/lombcoeff.m trunk/octave-forge/extra/lssa/lscomplex.m trunk/octave-forge/extra/lssa/lsreal.m Added Paths: ----------- trunk/octave-forge/extra/lssa/SampleScriptWithVostokData Added: trunk/octave-forge/extra/lssa/SampleScriptWithVostokData =================================================================== --- trunk/octave-forge/extra/lssa/SampleScriptWithVostokData (rev 0) +++ trunk/octave-forge/extra/lssa/SampleScriptWithVostokData 2012-07-12 05:03:35 UTC (rev 10742) @@ -0,0 +1,53 @@ +## Copyright (C) 2012 Benjamin Lewis +## Licensed under the GNU GPL v2 + +## This is just a sample script to introduce the purpose and usage of +## the Lomb-Scargle Least Squares method with experimental data, here +## using the Vostok ice core data collected and measured by J.R. Petit +## et. al. and published in Nature; also available from the NOAA's +## Paleoclimatology pages here: +## <http://www.ncdc.noaa.gov/paleo/icecore/antarctica/vostok/vostok_data.html>. + +co2 = csvread("./data/co2.csv")(2:end,2:end); +ch4 = csvread("./data/ch4.csv")(2:end,2:end); +o18 = csvread("./data/o18.csv")(2:end,2:end); +deut = csvread("./data/deut.csv")(2:end,2:end); +dust = csvread("./data/dust.csv")(2:end,2:end); +## The limited ranges are to deal with artifacts from the extraction of +## the R data, notably that it leaves an extra column on the front of 0s +## and the first row is text that Octave refuses to process. + +## Columns in co2 are Depth, Ice Age, Gas Age, and CO2 Concentration. +## Columns in ch4 are Depth, Ice Age, Gas Age, and CH4 Concentration. +## Columns in o18 are Depth, Ice Age, Gas Age, and Atmospheric O18. +## Columns in dust are Depth, Ice Age, Dust Concentration. +## Columns in deut are Depth, Ice Age, D concentration, and DeltaTS. + +co2_fig = figure("visible","off","name","CO2"); +ch4_fig = figure("visible","off","name","CH4"); +o18_fig = figure("visible","off","name","O18"); +deut_fig = figure("visible","off","name","Deuterium"); +dust_fig = figure("visible","off","name","Dust"); +## Generates figures and attaches handles to them for easy access. + +## Now we need some data to display; I'll run a few functions. +ls_complex_co2_ice_age = lscomplex(co2(:,2),co2(:,4),1,100,20); +ls_complex_co2_gas_age = lscomplex(co2(:,3),co2(:,4),1,100,20); +ls_real_co2_ice_age = lsreal(co2(:,2),co2(:,4),1,100,20); +ls_real_co2_gas_age = lsreal(co2(:,3),co2(:,4),1,100,20); + +figure(co2_fig); +subplot(4,2,1); +plot(-(co2(:,2)),co2(:,4)); +title("Gas levels over ice age"); +subplot(4,2,2); +plot(-(co2(:,3),co2(:,4)); +title("Gas levels over gas age"); +subplot(4,2,3); + + +## to implement: +## - displays of all the data and flaws in trying to model with just + ## using L-S data +## - correlations of every data set with every other data set +## - Comparing ls* results to periodogram results \ No newline at end of file Modified: trunk/octave-forge/extra/lssa/data/o18.csv =================================================================== --- trunk/octave-forge/extra/lssa/data/o18.csv 2012-07-10 14:20:31 UTC (rev 10741) +++ trunk/octave-forge/extra/lssa/data/o18.csv 2012-07-12 05:03:35 UTC (rev 10742) @@ -1,523 +1,319 @@ -"","depth.corrected","Ice.age..GT4.","Dust.Conc..ppm." -"1",124,4509,0.025 -"2",125,4552,0.018 -"3",128,4690,0.015 -"4",140,5259,0.033 -"5",149,5674,0.028 -"6",166,6486,0.013 -"7",174,6874,0.02 -"8",175,6924,0.018 -"9",182,7267,0.038 -"10",191,7697,0.023 -"11",192,7745,0.065 -"12",199,8091,0.038 -"13",220,9107,0.04 -"14",224,9298,0.05 -"15",244,10265,0.018 -"16",249,10515,0.03 -"17",256,10861,0.033 -"18",260,11053,0.045 -"19",274,11749,0.05 -"20",278,11973,0.025 -"21",288,12569,0.075 -"22",296,13055,0.075 -"23",299,13237,0.04 -"24",309,13828,0.033 -"25",319,14404,0.085 -"26",324,14713,0.163 -"27",325,14775,0.18 -"28",329,15032,0.17 -"29",349,16426,0.638 -"30",350,16502,0.773 -"31",352,16653,0.32 -"32",363,17544,1.098 -"33",374,18446,0.22 -"34",379,18870,1.21 -"35",399,20528,0.973 -"36",402,20777,0.71 -"37",403,20859,1.735 -"38",417,22023,0.733 -"39",424,22629,1.213 -"40",433,23412,1.745 -"41",447,24619,1.573 -"42",449,24781,0.668 -"43",451,24941,0.45 -"44",460,25697,0.968 -"45",474,26849,1.48 -"46",475,26933,1.353 -"47",492,28420,0.51 -"48",499,29006,0.415 -"49",500,29085,0.365 -"50",502,29249,0.783 -"51",524,31130,0.708 -"52",549,33209,0.495 -"53",574,35185,0.09 -"54",575,35261,0.113 -"55",598,37066,0.49 -"56",599,37148,0.603 -"57",601,37313,0.293 -"58",624,39185,0.203 -"59",625,39263,0.22 -"60",649,41191,0.188 -"61",650,41268,0.21 -"62",674,43073,0.238 -"63",675,43150,0.185 -"64",698,45055,0.19 -"65",699,45139,0.468 -"66",700,45225,0.375 -"67",724,47295,0.28 -"68",749,49350,0.128 -"69",750,49430,0.208 -"70",774,51306,0.073 -"71",775,51384,0.15 -"72",777,51549,0.295 -"73",799,53355,0.19 -"74",800,53436,0.165 -"75",802,53606,0.155 -"76",823,55377,0.278 -"77",824,55457,0.205 -"78",848,57289,0.21 -"79",849,57362,0.145 -"80",873,59262,0.833 -"81",874,59345,0.468 -"82",898,61406,0.475 -"83",899,61496,0.378 -"84",923,63688,0.98 -"85",924,63776,0.708 -"86",948,66045,1.1 -"87",949,66144,0.748 -"88",955,66708,0.425 -"89",973,68424,1.285 -"90",974,68520,0.86 -"91",984,69413,0.328 -"92",993,70243,0.305 -"93",998,70683,0.16 -"94",999,70766,0.063 -"95",1005,71264,0.085 -"96",1015,72070,0.098 -"97",1023,72753,0.155 -"98",1024,72840,0.053 -"99",1034,73706,0.19 -"100",1041,74322,0.205 -"101",1048,74903,0.063 -"102",1049,74985,0.103 -"103",1073,76854,0.073 -"104",1074,76933,0.075 -"105",1098,78937,0.178 -"106",1099,79020,0.233 -"107",1123,80869,0.28 -"108",1124,80943,0.193 -"109",1144,82352,0.078 -"110",1148,82647,0.188 -"111",1149,82721,0.223 -"112",1173,84378,0.068 -"113",1174,84448,0.058 -"114",1198,86016,0.065 -"115",1199,86083,0.078 -"116",1223,87766,0.09 -"117",1224,87837,0.09 -"118",1248,89597,0.19 -"119",1249,89672,0.208 -"120",1273,91480,0.113 -"121",1274,91547,0.12 -"122",1298,93254,0.27 -"123",1299,93325,0.238 -"124",1323,95000,0.07 -"125",1324,95070,0.103 -"126",1348,96722,0.048 -"127",1349,96791,0.043 -"128",1350,96861,0.053 -"129",1373,98505,0.075 -"130",1374,98572,0.068 -"131",1375,98640,0.005 -"132",1398,100232,0.17 -"133",1399,100301,0.14 -"134",1423,101868,0.133 -"135",1424,101930,0.11 -"136",1448,103481,0.248 -"137",1449,103553,0.18 -"138",1450,103625,0.315 -"139",1451,103697,0.258 -"140",1473,105271,0.058 -"141",1474,105342,0.058 -"142",1475,105413,0.058 -"143",1498,107048,0.128 -"144",1499,107121,0.098 -"145",1500,107194,0.085 -"146",1523,109121,0.093 -"147",1524,109206,0.05 -"148",1525,109292,0.065 -"149",1548,111159,0.07 -"150",1549,111239,0.043 -"151",1550,111319,0.01 -"152",1573,113195,0.05 -"153",1574,113272,0.078 -"154",1575,113348,0.043 -"155",1582,113891,0.068 -"156",1591,114562,0.058 -"157",1598,115077,0.035 -"158",1599,115150,0.08 -"159",1606,115617,0.028 -"160",1616,116296,0.048 -"161",1623,116762,0.033 -"162",1624,116827,0.028 -"163",1625,116891,0.073 -"164",1632,117326,0.068 -"165",1635,117514,0.015 -"166",1643,118012,0.035 -"167",1648,118314,0.038 -"168",1649,118376,0.058 -"169",1655,118735,0.11 -"170",1665,119345,0.045 -"171",1673,119831,0.04 -"172",1674,119894,0.038 -"173",1675,119955,0.073 -"174",1682,120379,0.053 -"175",1692,120959,0.085 -"176",1698,121314,0.02 -"177",1699,121373,0.013 -"178",1709,121951,0.018 -"179",1716,122345,0.213 -"180",1723,122742,0.055 -"181",1724,122801,0.053 -"182",1732,123268,0.06 -"183",1739,123658,0.04 -"184",1749,124209,0.12 -"185",1756,124599,0.048 -"186",1761,124877,0.043 -"187",1768,125271,0.028 -"188",1783,126103,0.078 -"189",1798,126904,0.048 -"190",1799,126955,0.06 -"191",1800,127006,0.26 -"192",1816,127810,0.043 -"193",1823,128161,0.028 -"194",1824,128210,0.038 -"195",1825,128259,0.045 -"196",1830,128501,0.018 -"197",1848,129428,0.135 -"198",1849,129486,0.115 -"199",1850,129545,0.02 -"200",1866,130410,0.035 -"201",1872,130759,0.015 -"202",1873,130819,0.113 -"203",1874,130880,0.038 -"204",1875,130942,0.14 -"205",1879,131190,0.045 -"206",1883,131439,0.033 -"207",1886,131641,0.023 -"208",1890,131908,0.02 -"209",1895,132264,0.03 -"210",1898,132477,0.048 -"211",1899,132548,0.045 -"212",1900,132619,0.078 -"213",1901,132691,0.055 -"214",1902,132763,0.038 -"215",1903,132836,0.055 -"216",1906,133065,0.025 -"217",1907,133142,0.06 -"218",1912,133528,0.06 -"219",1919,134091,0.105 -"220",1921,134266,0.095 -"221",1923,134447,0.5 -"222",1924,134538,0.12 -"223",1932,135308,0.298 -"224",1933,135408,0.095 -"225",1934,135507,0.105 -"226",1940,136103,0.16 -"227",1943,136411,0.123 -"228",1945,136614,0.245 -"229",1948,136923,0.883 -"230",1949,137026,0.86 -"231",1953,137446,0.158 -"232",1954,137549,0.183 -"233",1963,138532,0.288 -"234",1964,138644,0.235 -"235",1966,138868,0.553 -"236",1970,139308,0.338 -"237",1973,139643,0.848 -"238",1974,139756,0.498 -"239",1979,140319,0.405 -"240",1981,140542,0.553 -"241",1984,140876,0.688 -"242",1989,141434,0.245 -"243",1990,141547,0.438 -"244",1991,141661,0.303 -"245",1996,142218,0.565 -"246",1998,142440,1.01 -"247",1999,142551,0.753 -"248",2004,143117,0.625 -"249",2009,143675,0.74 -"250",2014,144237,0.46 -"251",2023,145226,0.973 -"252",2024,145337,0.673 -"253",2025,145449,0.738 -"254",2032,146242,0.528 -"255",2043,147459,0.423 -"256",2049,148141,0.77 -"257",2052,148471,0.158 -"258",2063,149679,0.265 -"259",2069,150333,0.55 -"260",2074,150868,0.418 -"261",2080,151502,0.325 -"262",2081,151611,0.318 -"263",2089,152513,0.313 -"264",2098,153523,0.871 -"265",2103,154094,0.305 -"266",2111,155029,1.177 -"267",2119,155983,1.228 -"268",2128,157080,0.671 -"269",2135,157909,0.715 -"270",2143,158815,0.426 -"271",2151,159651,0.13 -"272",2160,160626,0.237 -"273",2168,161545,0.728 -"274",2176,162440,0.238 -"275",2184,163318,0.22 -"276",2191,164136,0.36 -"277",2199,165148,0.618 -"278",2202,165522,0.092 -"279",2208,166284,0.271 -"280",2217,167414,0.115 -"281",2225,168391,0.154 -"282",2232,169201,0.073 -"283",2241,170221,0.151 -"284",2248,171040,0.284 -"285",2256,172004,0.307 -"286",2264,173027,0.025 -"287",2272,173988,0.105 -"288",2280,174920,0.142 -"289",2287,175746,0.232 -"290",2294,176630,0.391 -"291",2308,178417,0.341 -"292",2325,180546,0.202 -"293",2325,180546,0.067 -"294",2333,181502,0.138 -"295",2342,182694,0.236 -"296",2348,183525,0.561 -"297",2356,184641,0.715 -"298",2364,185788,0.761 -"299",2373,187067,0.274 -"300",2387,189030,0.147 -"301",2398,190469,0.05 -"302",2400,190705,0.055 -"303",2404,191156,0.016 -"304",2410,191895,0.114 -"305",2414,192382,0.067 -"306",2420,193152,0.142 -"307",2425,193816,0.141 -"308",2430,194444,0.052 -"309",2434,194926,0.104 -"310",2440,195676,0.113 -"311",2444,196202,0.221 -"312",2451,197086,0.067 -"313",2454,197462,0.111 -"314",2459,198075,0.114 -"315",2462,198426,0.074 -"316",2471,199452,0.047 -"317",2473,199682,0.052 -"318",2475,199904,0.063 -"319",2477,200124,0.048 -"320",2479,200345,0.021 -"321",2491,201635,0.03 -"322",2502,202826,0.029 -"323",2505,203155,0.024 -"324",2505.41,203200,0.024 -"325",2508.41,203527,0.023 -"326",2509,203592,0.021 -"327",2512.41,203980,0.02 -"328",2515,204278,0.029 -"329",2515.41,204325,0.028 -"330",2521,204973,0.022 -"331",2524.41,205386,0.032 -"332",2525,205458,0.024 -"333",2527.41,205760,0.032 -"334",2531,206232,0.025 -"335",2531.41,206287,0.028 -"336",2534.41,206681,0.031 -"337",2537.41,207072,0.042 -"338",2540.41,207463,0.041 -"339",2543.41,207857,0.023 -"340",2545,208061,0.029 -"341",2546.41,208244,0.023 -"342",2549.41,208623,0.031 -"343",2555.41,209364,0.028 -"344",2559.41,209864,0.021 -"345",2564.41,210466,0.023 -"346",2568.41,210941,0.032 -"347",2569.41,211057,0.015 -"348",2574.41,211651,0.022 -"349",2576.41,211892,0.04 -"350",2579.41,212237,0.029 -"351",2583.41,212700,0.03 -"352",2585.41,212928,0.022 -"353",2597.41,214297,0.031 -"354",2600.41,214639,0.018 -"355",2603.41,214978,0.06 -"356",2607.41,215432,0.022 -"357",2612.41,216003,0.036 -"358",2612.41,216003,0.054 -"359",2615.41,216369,0.029 -"360",2619.41,216839,0.032 -"361",2629.41,217989,0.022 -"362",2634.41,218602,0.035 -"363",2637.41,219000,0.082 -"364",2640.41,219393,0.041 -"365",2642.41,219660,0.053 -"366",2646.41,220226,0.093 -"367",2651.41,220967,0.077 -"368",2653.41,221272,0.069 -"369",2660.41,222426,0.119 -"370",2664.41,223135,0.138 -"371",2667.41,223681,0.194 -"372",2670.41,224240,0.158 -"373",2674.41,224959,0.029 -"374",2677.41,225469,0.085 -"375",2680.41,225971,0.069 -"376",2684.41,226653,0.036 -"377",2691.41,227958,0.076 -"378",2694.41,228488,0.07 -"379",2697.41,229052,0.045 -"380",2701.41,229802,0.073 -"381",2703.41,230161,0.031 -"382",2706.41,230691,0.076 -"383",2715.41,232206,0.036 -"384",2715.41,232206,0.043 -"385",2718.41,232682,0.039 -"386",2719.41,232838,0.007 -"387",2721.41,233146,0.033 -"388",2721.41,233146,0.055 -"389",2723.41,233453,0.056 -"390",2733.41,234896,0.096 -"391",2736.41,235329,0.038 -"392",2748.41,236970,0.058 -"393",2751.41,237338,0.033 -"394",2754.41,237690,0.083 -"395",2756.41,237912,0.079 -"396",2762.41,238578,0.012 -"397",2765.41,238932,0.015 -"398",2768.41,239298,0.014 -"399",2771.41,239698,0.011 -"400",2774.41,240141,0.029 -"401",2777.41,240614,0.014 -"402",2780.41,241118,0.06 -"403",2780.41,241118,0.067 -"404",2783.41,241674,0.029 -"405",2786.41,242267,0.083 -"406",2789.41,242850,0.039 -"407",2792.41,243406,0.023 -"408",2795.41,243999,0.06 -"409",2797.41,244424,0.131 -"410",2797.41,244424,0.052 -"411",2798.41,244639,0.156 -"412",2801.41,245283,0.104 -"413",2807.41,246574,0.378 -"414",2816.41,248545,0.191 -"415",2819.41,249219,0.116 -"416",2825.41,250501,0.078 -"417",2828.41,251104,0.169 -"418",2834.41,252422,0.208 -"419",2837.41,253075,0.12 -"420",2840.41,253763,0.115 -"421",2846.41,255056,0.219 -"422",2849.41,255711,0.053 -"423",2852.41,256387,0.223 -"424",2858.41,257827,0.439 -"425",2864.41,259340,1.012 -"426",2868.41,260380,0.64 -"427",2871.41,261179,0.942 -"428",2874.41,261973,0.167 -"429",2878.41,263043,0.554 -"430",2883.41,264383,0.791 -"431",2888.41,265707,0.558 -"432",2897.41,268050,0.093 -"433",2903.41,269532,0.168 -"434",2907.41,270507,0.077 -"435",2913.41,271920,0.017 -"436",2918.41,273037,0.085 -"437",2922.41,273918,0.123 -"438",2928.41,275216,0.086 -"439",2937.41,277120,0.045 -"440",2943.41,278456,0.08 -"441",2948.41,279632,0.146 -"442",2954.41,281175,0.184 -"443",2958.41,282253,0.14 -"444",2968.41,284925,0.204 -"445",2974.41,286639,0.041 -"446",2978.41,287726,0.059 -"447",2981.41,288530,0.059 -"448",2987.41,290214,0.066 -"449",2993.41,291830,0.054 -"450",2998.41,293076,0.042 -"451",3001.41,293893,0.063 -"452",3005.41,295035,0.045 -"453",3008.41,295862,0.09 -"454",3017.41,298327,0.257 -"455",3021.41,299383,0.097 -"456",3025.41,300397,0.078 -"457",3028.41,301156,0.053 -"458",3031.41,301917,0.032 -"459",3034.41,302691,0.013 -"460",3035.41,302937,0.029 -"461",3038.41,303657,0.022 -"462",3044.41,305288,0.021 -"463",3047.41,306200,0.111 -"464",3050.41,307131,0.102 -"465",3053.41,308031,0.026 -"466",3056.41,308907,0.02 -"467",3058.41,309483,0.009 -"468",3061.41,310330,0.036 -"469",3065.41,311411,0.022 -"470",3068.41,312208,0.019 -"471",3077.41,314543,0.021 -"472",3080.41,315297,0.045 -"473",3085.41,316524,0.02 -"474",3086.41,316765,0.027 -"475",3088.41,317255,0.044 -"476",3091.41,317999,0.037 -"477",3098.41,319708,0.019 -"478",3107.41,321875,0.032 -"479",3110.41,322513,0.014 -"480",3118.41,324218,0.008 -"481",3124.41,325629,0.012 -"482",3128.41,326761,0.01 -"483",3131.41,327730,0.046 -"484",3137.41,329848,0.117 -"485",3140.41,331050,0.142 -"486",3147.41,334306,0.586 -"487",3148.41,334805,1.035 -"488",3152.41,336766,0.395 -"489",3155.41,338233,0.366 -"490",3158.41,339706,0.439 -"491",3161.41,341187,0.164 -"492",3164.41,342594,0.034 -"493",3172.41,346523,0.277 -"494",3178.41,349620,0.401 -"495",3188.41,355187,0.38 -"496",3194.41,358466,0.24 -"497",3197.41,360071,0.155 -"498",3205.41,364333,0.076 -"499",3208.41,365962,0.268 -"500",3211.41,367507,0.058 -"501",3214.41,369034,0.091 -"502",3218.41,371188,0.224 -"503",3221.41,372991,0.208 -"504",3224.41,374711,0.071 -"505",3227.41,376381,0.085 -"506",3233.41,379524,0.019 -"507",3236.41,381227,0.125 -"508",3238.41,382318,0.033 -"509",3248.41,388065,0.122 -"510",3254.41,391928,0.114 -"511",3257.41,393908,0.157 -"512",3260.41,395792,0.023 -"513",3263.41,397482,0.023 -"514",3266.41,399134,0.019 -"515",3268.41,400228,0.021 -"516",3274.41,403501,0.033 -"517",3278.41,405617,0.016 -"518",3287.41,410200,0.018 -"519",3288.41,410683,0.012 -"520",3300.41,417095,0.013 -"521",3306.41,420527,0.015 -"522",3308.41,421761,0.012 +"","Depth.corrected","Ice.age..GT4.","gas.age..GT4.","Atm.O18" +"1",114.8,4095,724,-0.06 +"2",116.3,4168,813,0.03 +"3",120.3,4352,987,-0.06 +"4",125.2,4561,1184,-0.02 +"5",130.1,4791,1418,0.08 +"6",135.3,5039,1675,0.04 +"7",139.7,5245,1932,-0.05 +"8",139.8,5250,1935,0.14 +"9",143.7,5429,2108,-0.09 +"10",149.6,5702,2370,-0.05 +"11",152.8,5854,2541,-0.09 +"12",156.9,6048,2745,-0.08 +"13",161.8,6279,3041,-0.11 +"14",165.1,6441,3214,-0.13 +"15",166.8,6526,3306,-0.05 +"16",169.7,6665,3453,-0.15 +"17",174.2,6884,3679,0.06 +"18",174.6,6905,3695,-0.14 +"19",177.1,7028,3814,0.04 +"20",184.3,7379,4262,0.15 +"21",184.9,7408,4299,-0.19 +"22",205.6,8403,5207,-0.18 +"23",213.1,8768,5529,-0.13 +"24",213.8,8801,5559,-0.2 +"25",224,9298,6009,-0.24 +"26",230,9589,6278,-0.05 +"27",230.4,9608,6293,-0.11 +"28",250,10564,7313,0.1 +"29",252.9,10711,7475,-0.21 +"30",270.8,11579,8285,0.04 +"31",271.3,11606,8318,0.06 +"32",280.2,12099,8808,0.04 +"33",280.9,12139,8856,-0.11 +"34",281.3,12161,8879,-0.38 +"35",290.4,12719,9443,0.24 +"36",291.3,12773,9503,0.33 +"37",294.5,12964,9655,0.25 +"38",298.5,13208,9898,0.29 +"39",299.5,13267,9952,0.24 +"40",311.1,13944,10544,0.58 +"41",311.6,13971,10570,0.32 +"42",322.6,14627,11066,0.88 +"43",322.8,14639,11073,0.93 +"44",330.5,15133,11288,0.9 +"45",336.7,15549,11499,0.72 +"46",345.8,16185,11909,0.87 +"47",355.9,16962,12609,1.11 +"48",363.9,17618,13299,1.02 +"49",372,18283,13850,1.21 +"50",372.1,18291,13853,0.97 +"51",383,19199,14302,1.06 +"52",396.1,20286,14927,1.23 +"53",400.2,20628,15123,0.91 +"54",410.2,21459,15615,0.92 +"55",422.3,22483,16185,1.16 +"56",422.4,22491,16189,1.33 +"57",431.4,23270,16719,0.97 +"58",446.5,24579,17937,0.98 +"59",456.5,25402,18797,0.89 +"60",467.6,26310,19661,0.74 +"61",476.7,27079,20435,0.98 +"62",486.7,27969,21288,0.82 +"63",495.8,28752,21999,0.67 +"64",496.8,28832,22076,0.76 +"65",502.4,29282,22590,0.9 +"66",511.9,30114,23561,0.49 +"67",515.5,30411,23928,1.02 +"68",528,31473,25057,0.44 +"69",537.1,32227,25812,0.44 +"70",547.1,33047,26477,0.41 +"71",562,34281,27904,0.37 +"72",571.9,35024,28784,0.33 +"73",576.4,35366,29056,0.47 +"74",576.5,35374,29062,0.52 +"75",597.8,37049,30942,0.35 +"76",615.8,38518,32740,0.64 +"77",627.8,39483,34133,0.58 +"78",631.5,39774,34495,0.58 +"79",636.8,40205,34893,0.57 +"80",637.8,40291,34947,0.29 +"81",645.7,40930,35449,0.49 +"82",659.7,41977,36237,0.46 +"83",671.7,42892,37241,0.49 +"84",677.7,43359,37752,0.57 +"85",686.6,44086,38599,0.52 +"86",696.6,44939,39582,0.43 +"87",709.6,46070,41011,0.57 +"88",721.5,47092,41928,0.65 +"89",734.5,48176,42711,0.46 +"90",747.5,49233,43509,0.5 +"91",759.4,50169,44336,0.43 +"92",771.4,51117,45279,0.43 +"93",784.4,52146,46655,0.29 +"94",796.3,53133,47826,0.18 +"95",809.3,54224,49156,0.31 +"96",821.3,55243,50188,0.56 +"97",834.2,56254,51152,0.37 +"98",846.2,57154,51881,0.33 +"99",859.2,58148,52763,0.22 +"100",871.1,59101,53867,0.3 +"101",884.1,60185,55442,0.26 +"102",892.2,60887,56257,0.6 +"103",897.1,61326,56713,0.31 +"104",909,62401,57529,0.77 +"105",921,63512,58373,0.71 +"106",934,64698,59346,0.8 +"107",945.9,65847,60229,0.72 +"108",959.9,67169,61370,0.77 +"109",970.9,68222,62301,0.67 +"110",983.8,69393,63515,0.83 +"111",1020.5,72532,66581,0.77 +"112",1032.6,73589,67850,0.78 +"113",1045.6,74703,69299,0.71 +"114",1056.7,75602,70607,0.65 +"115",1069.8,76605,71543,0.56 +"116",1082.8,77674,72407,0.58 +"117",1095.9,78766,73689,0.42 +"118",1108,79714,74974,0.35 +"119",1121,80719,75937,0.31 +"120",1133.1,81599,76634,0.37 +"121",1146.2,82515,77505,0.14 +"122",1158.3,83352,78596,0.07 +"123",1171.3,84259,79753,0.02 +"124",1183.4,85062,80841,-0.05 +"125",1196.5,85915,81826,-0.03 +"126",1209.5,86812,82827,-0.25 +"127",1221.6,87666,83681,-0.21 +"128",1233.7,88548,84668,0.21 +"129",1234.7,88623,84733,0.13 +"130",1245.6,89419,85433,0.37 +"131",1246.8,89512,85498,0.05 +"132",1258.8,90423,86174,0.31 +"133",1284,92259,87755,0.26 +"134",1297,93180,88597,0.37 +"135",1309.1,94033,89355,0.23 +"136",1322.2,94946,90430,0.33 +"137",1334.2,95775,91475,0.43 +"138",1347.3,96673,92352,0.47 +"139",1358.4,97469,93181,0.56 +"140",1384.5,99310,95132,0.48 +"141",1408.7,100949,96632,0.41 +"142",1432.8,102476,98365,0.02 +"143",1444.9,103266,99254,-0.11 +"144",1459,104266,100462,-0.07 +"145",1473,105271,101636,-0.11 +"146",1485.1,106121,102314,-0.01 +"147",1496.2,106917,102869,-0.14 +"148",1507.2,107784,103548,-0.14 +"149",1512.3,108224,104017,0.06 +"150",1520.3,108897,104686,0.14 +"151",1529.3,109650,105444,0.33 +"152",1539.4,110459,106102,0.46 +"153",1551.5,111439,106686,0.44 +"154",1566.2,112644,107470,0.59 +"155",1592,114639,109824,0.73 +"156",1636.3,117593,113370,0.73 +"157",1656.1,118802,115226,0.39 +"158",1683.3,120457,117267,0.28 +"159",1693.1,121024,117891,-0.07 +"160",1716.7,122384,119319,-0.21 +"161",1732.7,123308,120424,-0.19 +"162",1757,124654,121904,-0.25 +"163",1784.3,126177,123521,-0.34 +"164",1823.5,128186,125622,-0.22 +"165",1831.9,128592,126162,-0.21 +"166",1845.2,129284,127030,0.17 +"167",1858,129971,127752,0.27 +"168",1868.5,130554,128325,0.65 +"169",1882.3,131393,128995,1 +"170",1883.4,131465,129069,0.9 +"171",1907.6,133188,130379,1.13 +"172",1934.5,135557,131959,1.23 +"173",1954.6,137611,133340,1.21 +"174",1955.8,137733,133418,1.12 +"175",1965.5,138812,133941,1.16 +"176",1982.3,140689,135202,1.03 +"177",1990.8,141637,135994,0.86 +"178",2016.4,144496,138408,0.91 +"179",2058.8,149220,143362,0.59 +"180",2092.1,152863,147205,0.6 +"181",2104,154207,148765,0.74 +"182",2112.1,155163,149816,0.82 +"183",2132.2,157583,151981,0.98 +"184",2142,158702,153069,0.89 +"185",2161.1,160751,154894,0.88 +"186",2170,161776,156102,0.8 +"187",2191,164136,159270,0.87 +"188",2201.1,165412,160281,0.79 +"189",2222.4,168089,162810,0.66 +"190",2236.1,169649,163928,0.38 +"191",2254.1,171772,166309,0.09 +"192",2281.1,175045,169989,0.11 +"193",2293,176501,171357,-0.13 +"194",2301,177517,172412,-0.1 +"195",2312.2,178992,174181,0.04 +"196",2332,181382,176144,-0.01 +"197",2341.1,182570,177430,0.24 +"198",2353.1,184243,179606,0.47 +"199",2372.1,186941,181627,0.88 +"200",2391.1,189582,184076,0.87 +"201",2404.5,191213,185778,0.72 +"202",2415.4,192560,187408,0.53 +"203",2425.6,193893,189454,0.47 +"204",2435.6,195126,190962,0.38 +"205",2444.1,196215,191858,0.12 +"206",2455.2,197612,193211,-0.11 +"207",2465.2,198790,194611,-0.03 +"208",2472.2,199590,195320,-0.11 +"209",2492.2,201763,198189,-0.14 +"210",2502.4,202870,199497,-0.06 +"211",2509,203592,200370,-0.15 +"212",2512.4,203979,200759,0.04 +"213",2514.8,204256,201104,-0.02 +"214",2520.4,204903,201707,0.2 +"215",2520.8,204948,201751,0.03 +"216",2530.7,206189,202917,0.39 +"217",2531.7,206327,203049,0.15 +"218",2536.8,206995,203585,0.39 +"219",2546.4,208243,204656,0.66 +"220",2549.7,208659,204934,0.52 +"221",2554.8,209293,205426,0.51 +"222",2572.7,211450,207759,0.47 +"223",2586.7,213077,209691,0.35 +"224",2595.7,214103,210894,0.26 +"225",2607.7,215464,212419,0.06 +"226",2616.7,216523,213539,-0.06 +"227",2625.7,217550,214611,-0.12 +"228",2634.7,218639,215622,-0.14 +"229",2644.7,219976,217045,0 +"230",2649.7,220719,217606,0.13 +"231",2658.7,222130,218640,0.05 +"232",2667.2,223642,219735,0.08 +"233",2677.2,225433,221031,0.14 +"234",2686.2,226975,222104,0.44 +"235",2692.2,228100,223181,0.51 +"236",2699.2,229392,224894,0.77 +"237",2706.2,230654,225994,0.84 +"238",2712.2,231682,226779,0.68 +"239",2718.2,232649,227928,0.65 +"240",2734.2,235013,231061,0.37 +"241",2736.2,235299,231478,0.27 +"242",2739.2,235722,232087,0.24 +"243",2743.2,236277,232849,0.09 +"244",2745.2,236545,233199,-0.01 +"245",2763.9,238752,235990,0.03 +"246",2772.9,239913,237741,0.48 +"247",2778.9,240859,238490,0.76 +"248",2787.9,242559,239486,0.75 +"249",2796.9,244313,240495,0.62 +"250",2802.9,245599,241301,0.63 +"251",2811.9,247548,243128,0.84 +"252",2820.9,249542,244726,0.75 +"253",2828.9,251206,246382,0.63 +"254",2835.9,252757,247944,0.51 +"255",2844.9,254756,250337,0.45 +"256",2853.9,256735,252048,0.37 +"257",2859.9,258202,253691,0.47 +"258",2869.9,260776,255933,0.59 +"259",2877.9,262907,257646,0.69 +"260",2885.9,265028,259567,0.66 +"261",2891.9,266614,261142,0.66 +"262",2900.9,268897,263563,0.73 +"263",2909.9,271097,266106,0.56 +"264",2918.9,273148,268568,0.4 +"265",2924.9,274459,270247,0.2 +"266",2933.9,276388,272620,0 +"267",2942.9,278337,274784,-0.15 +"268",2948.9,279752,276308,-0.09 +"269",2957.9,282123,278250,0 +"270",2965.9,284181,279851,-0.03 +"271",2971.9,285948,281656,0.09 +"272",2980.9,288387,283752,0.53 +"273",2989.9,290913,286629,0.6 +"274",2995.9,292475,288134,0.59 +"275",3004.9,294900,291089,0.45 +"276",3013.9,297367,293273,0.25 +"277",3019.9,298989,295052,-0.02 +"278",3028.9,301282,297568,0.02 +"279",3037.9,303533,300215,0.19 +"280",3043.9,305141,301918,0.26 +"281",3052.9,307880,304243,0.57 +"282",3061.9,310471,306589,0.59 +"283",3067.9,312072,308551,0.56 +"284",3076.9,314415,311344,0.38 +"285",3085.9,316647,313862,0.18 +"286",3091.9,318123,315533,-0.03 +"287",3100.9,320329,317837,-0.21 +"288",3109.9,322409,319956,-0.16 +"289",3115.9,323676,321706,0.03 +"290",3124.9,325754,323802,0.77 +"291",3130.9,327565,325218,1.02 +"292",3142.9,332112,328540,1.12 +"293",3147.9,334555,330355,1.19 +"294",3154.9,337989,332841,1.21 +"295",3160.9,340942,336045,1.05 +"296",3163.9,342356,337494,0.92 +"297",3172.9,346772,342238,0.7 +"298",3178.9,349884,345278,0.67 +"299",3184.9,353220,348373,0.68 +"300",3190.9,356559,351525,0.67 +"301",3196.9,359819,355044,0.63 +"302",3199.9,361384,356764,0.41 +"303",3208.9,366230,361967,0.07 +"304",3211.9,367764,363534,0.11 +"305",3220.9,372699,368878,0.23 +"306",3226.9,376115,371710,0.33 +"307",3232.9,379228,375539,0.15 +"308",3238.9,382590,378831,0.39 +"309",3244.9,385814,382627,0.35 +"310",3250.9,389631,385590,0.65 +"311",3259.9,395516,391478,0.52 +"312",3268.9,400502,397554,0.55 +"313",3274.9,403775,401044,0.38 +"314",3277.9,405354,402666,0.24 +"315",3284.9,408947,406607,0.02 +"316",3290.9,411959,409860,-0.08 +"317",3296.9,415188,412938,0.02 +"318",3299.9,416824,414603,-0.06 Modified: trunk/octave-forge/extra/lssa/lombcoeff.m =================================================================== --- trunk/octave-forge/extra/lssa/lombcoeff.m 2012-07-10 14:20:31 UTC (rev 10741) +++ trunk/octave-forge/extra/lssa/lombcoeff.m 2012-07-12 05:03:35 UTC (rev 10742) @@ -22,19 +22,19 @@ ## @seealso{lombnormcoeff} ## @end deftypefn -%!shared t, x, o, maxfreq +%!test +%! shared t, x, o, maxfreq %! maxfreq = 4 / ( 2 * pi ); %! t = linspace(0,8); x = ( 2.*sin(maxfreq.*t) + 3.*sin((3/4)*maxfreq.*t) %! - 0.5 .* sin((1/4)*maxfreq.*t) - 0.2 .* cos(maxfreq .* t) %! + cos((1/4)*maxfreq.*t)); o = [ maxfreq , 3 / 4 * maxfreq , 1 / 4 * maxfreq ]; -%! assert( lombcoeff(t,x,o(1)) = ); -%! assert( lombcoeff(t,x,o(2)) = ); -%! assert( lombcoeff(t,x,o(3)) = ); +%!assert( lombcoeff(t,x,o(1)),10788.9848389923,5e-10 ); +%!assert( lombcoeff(t,x,o(2)),12352.6413413457,5e-10 ); +%!assert( lombcoeff(t,x,o(3)),13673.4098969780,5e-10 ); function coeff = lombcoeff(T, X, o) theta = atan2(sum(sin(2 .* o .* T )), sum(cos(2.*o.*T)))/ (2 * o ); - coeff = ( sum(X .* cos(o .* T - tau))**2)/(sum(cos(o.*T-tau).**2)) + - ( sum(X .* sin(o .* T - tau))**2)/(sum(sin(o.*T-tau).**2)); + coeff = ( sum(X .* cos(o .* T - theta))**2)/(sum(cos(o.*T-theta).**2)) + ( sum(X .* sin(o .* T - theta))**2)/(sum(sin(o.*T-theta).**2)); end function Modified: trunk/octave-forge/extra/lssa/lscomplex.m =================================================================== --- trunk/octave-forge/extra/lssa/lscomplex.m 2012-07-10 14:20:31 UTC (rev 10741) +++ trunk/octave-forge/extra/lssa/lscomplex.m 2012-07-12 05:03:35 UTC (rev 10742) @@ -26,7 +26,7 @@ %!test %! shared t, x, o, maxfreq %! maxfreq = 4 / ( 2 * pi ); t = [0:0.008:8]; x = ( 2.*sin(maxfreq.*t) + 3.*sin((3/4)*maxfreq.*t)- 0.5 .* sin((1/4)*maxfreq.*t) - 0.2 .* cos(maxfreq .* t) + cos((1/4)*maxfreq.*t)); o = [ maxfreq , 3 / 4 * maxfreq , 1 / 4 * maxfreq ]; -%! assert( lscomplex(t,x,maxfreq,2,2), [-0.40075 - 2.36687i , 1.22666 - 2.24390i , 1.93643 - 1.51554i , 2.12505 - 0.95410i ] ); +%! assert( lscomplex(t,x,maxfreq,2,2), [-0.400754376933531 - 2.366871097665244i, 1.226663545950135 - 2.243899314661490i, 1.936433327880238 - 1.515538553198501i, 2.125045509991203 - 0.954100898917708i ], 6e-14 ); Modified: trunk/octave-forge/extra/lssa/lsreal.m =================================================================== --- trunk/octave-forge/extra/lssa/lsreal.m 2012-07-10 14:20:31 UTC (rev 10741) +++ trunk/octave-forge/extra/lssa/lsreal.m 2012-07-12 05:03:35 UTC (rev 10742) @@ -25,9 +25,10 @@ %!shared t, x, o, maxfreq %! maxfreq = 4 / ( 2 * pi ); -%! t = linspace(0,8); x = ( 2.*sin(maxfreq.*t) + 3.*sin((3/4)*maxfreq.*t) -%! - 0.5 .* sin((1/4)*maxfreq.*t) - 0.2 .* cos(maxfreq .* t) -%! + cos((1/4)*maxfreq.*t)); o = [ maxfreq , 3 / 4 * maxfreq , 1 / 4 * maxfreq ]; +%! t = linspace(0,8); +%! x = ( 2.*sin(maxfreq.*t) + 3.*sin((3/4)*maxfreq.*t) - 0.5 .* sin((1/4)*maxfreq.*t) - 0.2 .* cos(maxfreq .* t) + cos((1/4)*maxfreq.*t)); +%! assert(lsreal(t,x,maxfreq,2,2),[-1.68275915310663 + 4.70126183846743i, 1.93821553170889 + 4.95660209883437i, 4.38145452686697 + 2.14403733658600i, 5.27425332281147 - 0.73933440226597i],6e-14) +%! #In the assert here, I've got an error bound large enough to catch individual system errors which would present no real issue. function transform = lsreal( t, x, omegamax, ncoeff, noctave) ## the R function runs the following command: @@ -38,7 +39,7 @@ ## where rp = complex(noctave*ncoeff) so ... I can just store that as noctave*ncoeff and have no ## problems, I guess. ## Possibly throw an error if ncoeff <= 0. - k = n = min(length(x),length(t)); ## THIS IS VECTOR-ONLY. I'd need to add another bit of code to + k = n = length(t); ## THIS IS VECTOR-ONLY. I'd need to add another bit of code to ## make it array-safe, and that's not knowing right now what else will be necessary. transform = zeros(1,(noctave * ncoeff)); ## In the C code, this is rendered as a Complex, but Octave doesn't care. od = 2 ^ ( - 1 / ncoeff ); ## this will cause a crash if ncoeff=0; prefer error & quit? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |