Леонид писал(а): Процесс вычисления и называется "интерполяцией", при которой неизвестная линия между двумя точками представляется прямой, параболой, или более сложной функцией. Сделал по прямой code_36897.txt
------------ Дoбавленo в 15.40:
Леонид писал(а): Методов сравнения множество, один вы назвали: метод наименьших квадратов, о других, полагаю, и не слышали, например коэффициент корреляции Пирсона Посмотрел я формулу Пирсона и понял что в формулах я никакой.С формулой МНК я тоже долго мучился пока не нашёл простой и понятный пример: http://www.ekonomika-st.ru/drugie/metodi/metodi-prognoz-1-5.htmlПоэтому попробовал без Пирсона и вот что получилось: Add(MainForm,2953706,196,175) { Width=836 Height=401 Caption="Interpolation" link(onCreate,3081374:doEvent1,[]) } Add(MultiElement,825036,511,203) { link(onEvent1,1711637:doEvent1,[]) link(Data1,14721144:Var2,[]) link(Data2,5519335:EndIdx,[]) } BEGIN_SDK Add(EditMulti,10317626,161,105) { EventCount=1 WorkCount=1 DataCount=2 VarCount=2 Width=713 Height=270 link(doWork1,3347095:doEnum,[(184,111)(184,139)]) link(Var1,13809460:getVar,[]) link(Var2,712369:getVar,[]) } Add(ArrayEnum,3347095,210,133) { Type=1 link(onItem,4986660:doCompare,[]) link(Array,10317626:Data1,[(216,124)(167,124)]) } Add(If_else,4986660,273,133) { Op2=Integer(0) link(onTrue,80791:doWork2,[]) link(onFalse,7277552:doSplit,[(330,146)(330,237)]) link(Op1,3347095:Index,[(279,121)(255,121)(255,178)(223,178)]) link(Op2,10317626:Data2,[(286,116)(174,116)]) } Add(MultiStrPart,10196188,371,133) { } Add(MultiStrPart,7277552,350,231) { link(onSplit,5783595:doCalc,[]) } Add(LineBreakEx,15711593,448,154) { Caption="x2" Type=2 } Add(MathParse,5783595,441,231) { DataCount=4 MathStr="max(abs(%1 - %2), abs(%3 - %4))" link(onResult,12180298:doFor,[]) link(X1,12815079:getVar,[]) link(X2,15711593:getVar,[]) link(X3,15559359:getVar,[]) link(X4,9531379:getVar,[]) } Add(LineBreakEx,12815079,441,133) { Caption="x1" Type=2 } Add(LineBreakEx,13467991,350,301) { Caption="x2" Type=3 link(_Data,7277552:Part1,[]) } Add(LineBreakEx,3925341,371,203) { Caption="x1" Type=3 link(_Data,10196188:Part1,[]) } Add(LineBreakEx,7081117,378,182) { Caption="y1" Type=3 link(_Data,10196188:Part2,[]) } Add(LineBreakEx,286866,357,280) { Caption="y2" Type=3 link(_Data,7277552:Part2,[]) } Add(LineBreakEx,15559359,455,175) { Caption="y1" Type=2 } Add(LineBreakEx,9531379,462,196) { Caption="y2" Type=2 } Add(For,12180298,504,231) { Start=1 link(onEvent,12669895:doOperation,[]) link(onStop,16266468:doData,[(562,244)(562,333)(198,333)(198,223)]) link(End,14211742:getVar,[]) } Add(LineBreakEx,14211742,511,196) { Caption="time" Type=2 } Add(LineBreakEx,2680954,441,280) { Caption="time" Type=3 link(_Data,5783595:Result,[]) } Add(Math,12669895,574,231) { OpType=3 link(onResult,15348708:doEvent1,[]) link(Op2,10369627:getVar,[]) } Add(LineBreakEx,10369627,581,196) { Caption="time" Type=2 } Add(MathParse,4133285,707,231) { DataCount=3 MathStr="%1 * (%3 - %2) + %2" ResultType=0 link(X1,5495768:getVar,[]) link(X2,8408257:getVar,[]) link(X3,1173412:getVar,[]) } Add(LineBreakEx,10520077,574,280) { Caption="delta" Type=3 link(_Data,12669895:Result,[]) } Add(LineBreakEx,5495768,707,161) { Caption="delta" Type=2 } Add(LineBreakEx,1173412,721,203) { Caption="x2" Type=2 } Add(LineBreakEx,8408257,714,182) { Caption="x1" Type=2 } Add(MathParse,1812742,791,266) { DataCount=3 MathStr="%1 * (%3 - %2) + %2" ResultType=0 link(onResult,10317626:onEvent1,[(849,272)(849,111)]) link(X1,10989008:getVar,[]) link(X2,5976396:getVar,[]) link(X3,7797808:getVar,[]) } Add(Hub,15348708,630,231) { OutCount=4 link(onEvent1,4133285:doCalc,[]) link(onEvent2,1812742:doCalc,[(692,244)(692,272)]) } Add(LineBreakEx,10989008,791,196) { Caption="delta" Type=2 } Add(LineBreakEx,5976396,798,217) { Caption="y1" Type=2 } Add(LineBreakEx,7797808,805,238) { Caption="y2" Type=2 } Add(DoData,16266468,210,217) { link(onEventData,80791:doWork3,[(347,223)]) link(Data,3347095:Item,[]) } Add(HubEx,80791,343,133) { link(onEvent,10196188:doSplit,[]) } Add(LineBreakEx,13809460,161,315) { Caption="x r" Type=2 } Add(LineBreakEx,712369,168,336) { Caption="y r" Type=2 } Add(LineBreakEx,13735767,707,280) { Caption="x r" Type=3 link(_Data,4133285:Result,[]) } Add(LineBreakEx,2081432,791,315) { Caption="y r" Type=3 link(_Data,1812742:Result,[]) } END_SDK Add(Plotter,11338811,357,126) { Width=648 Height=374 Align=1 Name="plotter" MaxH=20000 MaxW=5000 LeftMargin=50 RightMargin=30 TopMargin=30 BottomMargin=30 MouseControl=1 } Add(PlotPoints,11000259,595,140) { Grapher="plotter" Color=16711680 link(ValueY,10451469:Part2,[(601,128)(608,128)]) link(ValueX,10451469:Part1,[(608,128)(601,128)]) } Add(MultiStrPart,10451469,595,84) { link(onSplit,11000259:doAdd,[(644,90)(644,188)(583,188)(583,146)]) } Add(PlotPoints,16221510,602,749) { Grapher="plotter" link(ValueY,5611063:Result,[(608,737)(570,737)(570,793)(531,793)]) link(ValueX,12324089:Result,[(615,735)(652,735)(652,805)(468,805)]) } Add(StrList,5519335,497,63) { Strings=#10:5323;14717|10:5289;14684|10:5213;14613|10:4986;14365|10:4954;14330|10:4924;14245|10:4889;14223|10:4854;14185|10:4608;13923|10:4579;13877|10:4548;13830|10:4515;13801|10:4481;13770|10:4251;13479|10:4224;13424|10:4195;13394|10:4163;13358|10:4132;13330|10:4102;13271|10:3888;13003|10:3863;12971|10:3808;12896|10:3778;12832|10:3751;12793|10:3549;12533|10:3526;12471|10:3503;12438|10:3478;12407|10:3453;12345|10:3426;12293|10:3400;12283|10:3375;12233|10:3170;11908|10:3148;11878|10:3127;11846|10:3103;11784|10:3079;11754|10:3055;11720|10:3033;11677|10:2823;11314|10:2806;11282|10:2786;11205|10:2767;11189|10:2746;11158|10:2723;11105|10:2705;11079|10:2684;11045|10:2665;10984|10:2463;10597|10:2448;10568|10:2432;10535|10:2416;10487|10:2398;10425|10:2381;10395|10:2363;10358|10:2346;10331|10:2329;10270|10:2313;10234|9:2099;9738|9:2087;9669|9:2073;9628|9:2061;9596|9:2047;9563|9:2034;9532|9:2020;9454|9:2004;9437|9:1992;9395|9:1978;9354|9:1952;9293|9:1939;9237|9:1736;8579|9:1714;8520|9:1706;8479|9:1694;8440|9:1685;8408|9:1674;8346|9:1663;8313|9:1652;8285|9:1641;8254|9:1620;8166|9:1609;8104|9:1599;8095|9:1589;8051|9:1371;7189|9:1354;7127|9:1345;7094|9:1336;7032|9:1327;6989|9:1318;6955|9:1308;6921|9:1299;6895|9:1290;6832|9:1280;6793|9:1271;6768|9:1262;6720|9:1253;6657|9:1244;6625|9:1235;6596|9:1226;6566|8:991;5520|8:976;5454|8:968;5410|8:960;5328|8:952;5312|8:943;5269|8:935;5235|8:926;5167|8:918;5158|8:910;5107|8:902;5079|8:894;5048|8:886;4981|8:616;3658|8:610;3595|8:603;3562|8:588;3487|8:581;3457|8:574;3407|8:566;3357|8:559;3329|8:552;3270|8:545;3229|8:537;3190|8:523;3128|8:517;3095|8:274;1718|8:271;1667|8:234;1457|8:227;1392|8:221;1344|8:214;1315|8:208;1282|8:200;1254|8:195;1220|8:188;1160|8:182;1104|8:176;1095|8:170;1041|7:164;979|7:158;957|7:152;923| Point(EndIdx) } Add(ArrayEnum,6521434,427,168) { link(onItem,10451469:doSplit,[(557,174)(557,90)]) link(Array,14721144:Var1,[(433,124)]) } Add(GetDataEx,14721144,511,119) { link(Data,5519335:Array,[]) } Add(Hub,3081374,287,189) { OutCount=5 link(onEvent1,11338811:doClear,[(324,195)(324,132)]) link(onEvent2,6521434:doEnum,[(364,202)(364,174)]) link(onEvent3,825036:doWork1,[]) link(onEvent4,13687361:doWork1,[(336,216)(336,615)]) link(onEvent5,8247016:doEnum,[(315,223)(315,755)]) } Add(Hub,1711637,560,203) { OutCount=4 link(onEvent2,4372303:doWork1,[(633,216)(633,300)]) link(onEvent4,13856730:doWrite,[(598,230)(598,594)]) } Add(LineBreakEx,8148234,511,273) { Caption="x r" Type=3 link(_Data,825036:Var1,[]) } Add(LineBreakEx,3020863,518,252) { Caption="y r" Type=3 link(_Data,825036:Var2,[]) } Add(StrList,6483199,462,329) { Strings=#9:1468;1750|9:1394;1672|9:1356;1614|9:1129;1391|9:1097;1360|9:1064;1300|9:1028;1251|8:993;1220|8:779;1000|7:751;948|7:720;886|7:686;861|7:653;833|7:420;562|7:365;486|7:334;438|7:303;387|7:272;332|5:55;64|5:30;31|3:4;0| } Add(Matrix,10730410,707,455) { Col=1 Row=100000 } Add(MatrixRW,13856730,707,581) { link(Matrix,1991483:Var2,[]) link(Value,16417680:getVar,[]) link(X,15335385:Value,[]) link(Y,5756708:getVar,[]) } Add(LineBreakEx,5756708,728,553) { Caption="x r" Type=2 } Add(LineBreakEx,16417680,714,497) { Caption="y r" Type=2 } Add(GetDataEx,1991483,707,504) { link(Data,10730410:Matrix,[]) } Add(Memo,6059881,476,609) { Left=665 Top=155 Width=155 Height=210 ScrollBars=3 } Add(MultiElement,13687361,371,609) { link(onEvent1,6059881:doAdd,[]) link(Data1,16525829:getVar,[]) link(Data2,8030626:getVar,[]) link(Data3,10070457:getVar,[]) link(Data4,10159685:getVar,[]) link(Data5,8489901:getVar,[]) } BEGIN_SDK Add(EditMulti,9420625,77,70) { EventCount=1 WorkCount=1 DataCount=5 VarCount=2 Width=839 Height=480 link(doWork1,14917670:doFor,[(137,76)(137,209)]) link(Var1,16157188:Var1,[(83,383)]) link(Var2,3980007:Var1,[(90,390)]) } Add(For,14917670,154,203) { link(onEvent,10992255:doEvent1,[]) link(onStop,14205258:doData,[(202,216)(202,503)]) link(Start,9420625:Data1,[(160,193)(83,193)]) link(End,9420625:Data2,[(167,185)(90,185)]) } Add(MultiElement,2258603,273,210) { link(onEvent1,4364751:doEnum,[]) link(Data1,4993822:getVar,[]) link(Data2,5340583:getVar,[]) } BEGIN_SDK Add(EditMulti,2388495,238,77) { EventCount=1 WorkCount=1 DataCount=2 VarCount=1 Width=314 Height=144 link(doWork1,3555446:doEvent1,[(290,83)(290,160)]) link(Var1,4754797:Value,[(244,196)(510,196)]) } Add(MatrixRW,9641047,448,154) { link(onRead,4754797:doValue,[]) link(Matrix,2388495:Data1,[(454,112)(244,112)]) link(X,16279543:Value,[]) link(Y,2388495:Data2,[(475,99)(251,99)]) } Add(Hub,3555446,315,154) { link(onEvent1,9641047:doRead,[]) link(onEvent2,3363590:In,[]) } Add(Memory,4754797,504,154) { } Add(LineBreak,13068488,469,77) { link(Out,2388495:onEvent1,[]) Primary=[3363590,-126,84] } Add(Memory,16279543,462,105) { Default=Integer(0) } END_SDK Add(LineBreakEx,4993822,273,161) { Caption="matrix 2" Type=2 } Add(LineBreakEx,12344914,91,161) { Caption="matrix 2" Type=3 link(_Data,9420625:Data3,[]) } Add(ArrayEnum,4364751,336,210) { Type=1 link(onItem,3003397:doSplit,[]) link(Array,9804577:getVar,[]) } Add(LineBreakEx,10960279,98,140) { Caption="schedule B" Type=3 link(_Data,9420625:Data4,[]) } Add(LineBreakEx,9804577,336,182) { Caption="schedule B" Type=2 } Add(MultiStrPart,3003397,399,210) { link(onSplit,14105844:doOperation,[]) } Add(Hub,10992255,210,203) { OutCount=3 link(onEvent1,5452385:In,[]) link(onEvent2,2258603:doWork1,[]) link(onEvent3,2634146:doCalc,[(245,223)(245,433)]) } Add(Math,14105844,476,210) { ResultType=0 link(onResult,8201124:doOperation,[]) link(Op1,1046789:getVar,[]) link(Op2,7799753:getVar,[]) } Add(Math,8201124,539,210) { ResultType=0 link(onResult,16101311:doRead,[]) link(Op1,1276585:getVar,[]) link(Op2,15956245:getVar,[]) } Add(LineBreakEx,1046789,476,161) { Caption="row a" Type=2 } Add(LineBreakEx,8558509,154,252) { Caption="row a" Type=3 link(_Data,14917670:Position,[]) } Add(LineBreakEx,7799753,483,182) { Caption="x b" Type=2 } Add(LineBreakEx,2559611,399,280) { Caption="x b" Type=3 link(_Data,3003397:Part1,[]) } Add(LineBreakEx,1276585,539,161) { Caption="y a" Type=2 } Add(LineBreakEx,15956245,546,182) { Caption="y b" Type=2 } Add(LineBreakEx,321729,273,266) { Caption="y a" Type=3 link(_Data,2258603:Var1,[]) } Add(LineBreakEx,1817859,406,259) { Caption="y b" Type=3 link(_Data,3003397:Part2,[]) } Add(MatrixRW,16101311,616,210) { link(onRead,7383795:doCalc,[]) link(Matrix,13378990:getVar,[]) link(X,4463066:Value,[]) link(Y,14115851:getVar,[]) } Add(LineBreakEx,14115851,637,161) { Caption="row" Type=2 } Add(LineBreakEx,14079955,693,168) { Caption="y" Type=2 } Add(LineBreakEx,11547055,476,259) { Caption="row" Type=3 link(_Data,14105844:Result,[]) } Add(LineBreakEx,11613634,539,259) { Caption="y" Type=3 link(_Data,8201124:Result,[]) } Add(Memory,10291219,826,210) { Default=Integer(0) } Add(LineBreak,16354704,784,217) { Caption="0" link(Out,10291219:doClear,[]) Primary=[5452385,-546,-14] } Add(FormatStr,2817329,756,427) { DataCount=3 Mask="x = %1__y = %2__отклонение = %3" Point(FString) link(Str1,16157188:Var2,[(762,408)(720,408)]) link(Str2,3980007:Var2,[]) link(Str3,952864:Var3,[(776,415)(809,415)(809,474)]) } Add(LineBreakEx,14820916,763,301) { Caption="y a" Type=2 } Add(LineBreakEx,5340583,280,182) { Caption="row a" Type=2 } Add(Memory,4463066,630,119) { Default=Integer(0) } Add(LineBreakEx,13378990,616,98) { Caption="matrix 2" Type=2 } Add(MathParse,7383795,686,210) { DataCount=3 MathStr="%3 + abs(%1 - %2)" link(onResult,10291219:doValue,[]) link(X2,14079955:getVar,[]) link(X3,9986176:Var3,[(706,198)(768,198)]) } Add(MathParse,2634146,441,427) { MathStr="%1 / %2" link(onResult,12418368:doCompare,[]) link(X1,9986176:Var1,[(447,292)]) link(X2,12229275:getVar,[]) } Add(GetDataEx,9986176,762,287) { Angle=1 link(Data,10291219:Value,[(832,292)]) } Add(LineBreakEx,9065641,105,119) { Caption="count" Type=3 link(_Data,9420625:Data5,[]) } Add(LineBreakEx,12229275,448,392) { Caption="count" Type=2 } Add(LineBreakEx,11734536,714,301) { Caption="row a" Type=2 } Add(Memory,8889423,567,427) { Default=Integer(100000) link(onData,8719419:doEvent1,[]) } Add(If_else,12418368,511,427) { Type=1 link(onTrue,8889423:doValue,[]) link(Op1,2634146:Result,[(517,415)(489,415)(489,473)(447,473)]) link(Op2,952864:Var1,[(524,414)(553,414)(553,474)]) } Add(DoData,14205258,756,497) { link(onEventData,9420625:onEvent1,[(873,503)(873,76)]) link(Data,2817329:FString,[]) } Add(GetDataEx,952864,567,469) { link(Data,8889423:Value,[]) } Add(Memory,6101071,714,336) { Point(Data) link(onData,1997299:doValue,[]) link(Data,11734536:getVar,[]) } Add(Memory,1997299,763,336) { Point(Data) link(Data,14820916:getVar,[]) } Add(Hub,8719419,616,427) { link(onEvent1,6101071:doValue,[(672,433)(672,342)]) link(onEvent2,2817329:doString,[(693,440)(693,433)]) } Add(GetDataEx,16157188,714,378) { link(Data,6101071:Value,[]) } Add(GetDataEx,3980007,763,385) { link(Data,1997299:Value,[]) } END_SDK Add(LineBreakEx,8030626,378,504) { Caption="до" Type=2 } Add(LineBreakEx,14443812,665,343) { Caption="до" Type=3 link(_Data,4372303:Var2,[]) } Add(LineBreakEx,10070457,385,525) { Caption="matrix 2" Type=2 } Add(LineBreakEx,15332270,623,553) { Caption="matrix 2" Type=3 link(_Data,1991483:Var1,[(629,509)]) } Add(LineBreakEx,10159685,392,546) { Caption="schedule B" Type=2 } Add(LineBreakEx,8141343,476,392) { Caption="schedule B" Type=3 link(_Data,6483199:Array,[]) } Add(Memory,15335385,721,518) { Default=Integer(0) } Add(MultiElement,4372303,658,294) { link(Data1,9929113:getVar,[]) } BEGIN_SDK Add(EditMulti,1402343,21,21) { WorkCount=1 DataCount=1 VarCount=2 Width=307 link(doWork1,13205004:doEvent1,[(56,27)(56,69)]) link(Var1,15498000:Var1,[(27,107)]) link(Var2,14013108:Var1,[(34,184)]) } Add(Hub,13205004,77,63) { link(onEvent1,4379425:doOperation,[]) link(onEvent2,8145461:doOperation,[(105,76)(105,146)]) } Add(Memory,14229060,231,63) { Default=Integer(100000) } Add(Memory,11012077,266,140) { Default=Integer(0) } Add(Math,4379425,147,63) { OpType=38 ResultType=0 link(onResult,14229060:doValue,[]) link(Op1,15345300:Var3,[(153,42)]) link(Op2,15498000:Var3,[(160,51)(212,51)]) } Add(Math,8145461,119,140) { OpType=39 link(onResult,11012077:doValue,[]) link(Op1,15345300:Var2,[]) link(Op2,14013108:Var3,[(132,128)(184,128)]) } Add(GetDataEx,15345300,119,37) { Angle=3 link(Data,1402343:Data1,[(27,42)]) } Add(GetDataEx,15498000,206,102) { Angle=1 link(Data,14229060:Value,[(237,107)]) } Add(GetDataEx,14013108,178,179) { Angle=1 link(Data,11012077:Value,[(272,184)]) } END_SDK Add(LineBreakEx,9929113,658,266) { Caption="x r" Type=2 } Add(LineBreakEx,12046057,658,364) { Caption="от" Type=3 link(_Data,4372303:Var1,[]) } Add(LineBreakEx,16525829,371,483) { Caption="от" Type=2 } Add(LineBreakEx,8489901,399,567) { Caption="count points B" Type=2 } Add(LineBreakEx,11421023,469,413) { Caption="count points B" Type=3 link(_Data,6483199:Count,[]) } Add(LineBreakEx,7285529,329,714) { Caption="schedule B" Type=2 } Add(ArrayEnum,8247016,329,749) { link(onItem,12803236:doSplit,[]) link(Array,7285529:getVar,[]) } Add(MultiStrPart,12803236,392,749) { link(onSplit,12324089:doOperation,[]) } Add(Math,12324089,462,749) { ResultType=0 link(onResult,5611063:doOperation,[]) link(Op1,12803236:Part1,[(468,736)(373,736)(373,793)(398,793)]) link(Op2,13687361:Var1,[(475,708)(377,708)]) } Add(Math,5611063,525,749) { ResultType=0 link(onResult,16221510:doAdd,[]) link(Op1,12803236:Part2,[(531,737)(510,737)(510,793)(405,793)]) link(Op2,13687361:Var2,[(538,695)(384,695)]) }
|