<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2399450</guid>
        <pubDate>Fri, 16 Oct 2009 19:38:18 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2399450</link>
        <description><![CDATA[ANDLL: Спасибо всем кто участвовал, общими усилиями вопрос решился.]]></description>
        <author>ANDLL</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395857</guid>
        <pubDate>Tue, 13 Oct 2009 11:59:17 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395857</link>
        <description><![CDATA[repz: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=284329&view=findpost&p=2395799'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>ANDLL &#064; <time class="tag-quote__quoted-time" datetime="2009-10-13T11:19:25+00:00">13.10.09, 11:19</time></span><div class='quote '><strong class='tag-b'>repz</strong><br>
А можно все таки уточнить, откуда именно появилась синяя линия?<br>
Интересует все таки метод получения, а не результат</div></div><br>
Здесь принципиально определиться что есть по &quot;ИКС&quot;<br>
Если это аргумент функции, который является некоторой физической величиной, и шкала не регулярна - это одна тема (хотя по представленным данным она вроде как регулярна)<br>
<br>
Ежели это шкала категории (номер события, шкала времени) - простая линейная регрессия (заявленной функции) с предиктором sin(BX+X0), где B и X0 параметры категории шкалы (просто задаются)]]></description>
        <author>repz</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395799</guid>
        <pubDate>Tue, 13 Oct 2009 11:19:25 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395799</link>
        <description><![CDATA[ANDLL: <strong class='tag-b'>repz</strong><br>
А можно все таки уточнить, откуда именно появилась синяя линия?<br>
Интересует все таки метод получения, а не результат]]></description>
        <author>ANDLL</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395408</guid>
        <pubDate>Tue, 13 Oct 2009 06:50:45 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395408</link>
        <description><![CDATA[repz: Аппроксимируется с детерминацией 0,999988927 и остаточной дисперсией 0,0005146545<br>методом множественной регрессии с линеаризацией синуса....<br><br>На графике синяя линия - результат аппроксимации...(в прикрепленном файле)<br><br>y=Asin(BX+X0)+Y0 имеет гармонику низшего порядка...а имеет ли она отношение к физической сути описываемого процесса...]]></description>
        <author>repz</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395347</guid>
        <pubDate>Tue, 13 Oct 2009 05:30:28 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395347</link>
        <description><![CDATA[shadeofgray: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=284329&view=findpost&p=2395055'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Pavia &#064; <time class="tag-quote__quoted-time" datetime="2009-10-12T17:12:01+00:00">12.10.09, 17:12</time></span><div class='quote '>shadeofgray<br>
К тебе притензия.<br>
Надо делить на N при прямом преобразовании, а не при обратном. Чтобы размерности совпадали.</div></div><br>
Это неоднозначный вопрос - половина людей делит на N при прямом, вторая половина - при обратном преобразовании. Как ни делай, кто-то будет недоволен :) Я решил сделать так, как реализовано в MATLAB - чтобы минимизировать количество непоняток у пользователей.]]></description>
        <author>shadeofgray</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395247</guid>
        <pubDate>Mon, 12 Oct 2009 21:10:55 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395247</link>
        <description><![CDATA[Pavia: Нашел где точность теряется. Надо убирать постоянную составляющую. А то она дает SinC на спекторе.<br>
Убирать как m:=mean(p); sub(p,m)<br>
<br>
Сразу точность возросла до максимума. Осалось понять что у меня с фазой. <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2009-10-12T21:38:00+00:00">12.10.09, 21:38</time></span></span><br>
Есть подозрение где еще теряется точность. Если сигнал обрублен  не целое число гармоник укладывается. Надо искать переход через ноль.]]></description>
        <author>Pavia</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395243</guid>
        <pubDate>Mon, 12 Oct 2009 21:06:04 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395243</link>
        <description><![CDATA[Prince: Люди, вы меня запутали. Объясните, что такое за формула:<br>
B:=1 / (pi/n*MaxI / 50) <br>
Я пытаюсь следить за ходом событий, и не почень получается.<br>
Вот <strong class='tag-b'>Pavia</strong> приводит формулу для В:<br>
B:=2*pi/n*MaxI / 50? <br>
50 - это шаг сетки по Х? Максимальная круговая частота в этом случае pi/50. Так? И значения В должны быть значительно меньше 1.<br>
И тут же следует другая формула. И В за 1000.  :ph34r: <br>
<br>
<br>
<div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Если мы увеличиваем частоту дискретизации нам это ничего не даст. Но если мы соберем больше по времени точек то точность повысится.</div></div> Если максимум расположен в районе 5-й гармоники, может, уменьшить частоту дискретизации? В этом случае точность тоже возрастет?]]></description>
        <author>Prince</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395231</guid>
        <pubDate>Mon, 12 Oct 2009 20:39:39 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395231</link>
        <description><![CDATA[Pavia: <strong class='tag-b'>ANDLL</strong><br>
Если мы увеличиваем частоту дискретизации нам это ничего не даст. Но если мы соберем больше по времени точек то точность повысится.<br>
Я увеличил в 2 раза число точек у меня ошибка у пала с 0.5 до 0.125 Не как не пойму куда точность девается.]]></description>
        <author>Pavia</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395221</guid>
        <pubDate>Mon, 12 Oct 2009 20:18:52 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395221</link>
        <description><![CDATA[ANDLL: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=284329&view=findpost&p=2395140'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Pavia &#064; <time class="tag-quote__quoted-time" datetime="2009-10-12T18:51:04+00:00">12.10.09, 18:51</time></span><div class='quote '><br>
Точность растет чем больше частота.</div></div>Я и говорю, получается что ничего подобного. При увеличении числа точек точность вовсе не растет, а плавает]]></description>
        <author>ANDLL</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395140</guid>
        <pubDate>Mon, 12 Oct 2009 18:51:04 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395140</link>
        <description><![CDATA[Pavia: 1/(pi/486*4/50) =1933,7325<br>
1/(pi/486*5*/50) =1546,986<br>
1/(pi/486*6/50) =1289,1550<br>
1/(pi/486*7/50)=1104,990033<br>
Точность растет чем больше частота.<br>
<br>
Так что надо уточнять. Либо используем предложенный метод многомерной оптимизации выше.  Лучше его в качестве начальных значений бери что получили после спектрального анализа.<br>
<br>
<br>
Либо использовать прямое ПФ.<br>
<br>
/была ошибка по правил/<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">function FT(w:Real; N:Integer; a:PComplex):Complex;Overload;</div><div class="code_line">var i:Integer;</div><div class="code_line">begin</div><div class="code_line">Result.Re:=0;</div><div class="code_line">Result.Im:=0;</div><div class="code_line">for i:=0 to N-1 do</div><div class="code_line">&nbsp;begin</div><div class="code_line">&nbsp;Result.Re:=Result.Re+A[i].Re*Cos(-2*Pi*i*w/N)-A[i].Im*Sin(-2*Pi*i*w/N);</div><div class="code_line">&nbsp;Result.Im:=Result.Im+A[i].Re*Sin(-2*Pi*i*w/N)+A[i].Im*Cos(-2*Pi*i*w/N);</div><div class="code_line">&nbsp;end;</div><div class="code_line">Result.Re:=Result.Re/N;</div><div class="code_line">Result.Im:=Result.Im/N;</div><div class="code_line">end;</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
<br>
Подставляешь w чем точнее тем больше будет результат FT. И дальше метод градиентного спуска или любой др. Правда дольше работать будет.]]></description>
        <author>Pavia</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395105</guid>
        <pubDate>Mon, 12 Oct 2009 18:10:38 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395105</link>
        <description><![CDATA[ANDLL: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=284329&view=findpost&p=2395055'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Pavia &#064; <time class="tag-quote__quoted-time" datetime="2009-10-12T17:12:01+00:00">12.10.09, 17:12</time></span><div class='quote '>B:=2*pi/n*MaxI / 50; 50 - твой шаг </div></div><br>
<strong class='tag-b'>Pavia</strong><br>
Только B = 1590, а по формуле B:=1 / (pi/n*MaxI / 50) получаются, в зависимости от выборки числа в разбросе от 1100 до 1900.]]></description>
        <author>ANDLL</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395055</guid>
        <pubDate>Mon, 12 Oct 2009 17:12:01 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395055</link>
        <description><![CDATA[Pavia: <strong class='tag-b'>shadeofgray</strong><br>
К тебе притензия. <br>
<br>
Надо делить на N при прямом преобразовании, а не при обратном. Чтобы размерности совпадали.<br>
<br>
<strong class='tag-b'>ANDLL</strong><br>
Предлагаю просто поделить на N как Re так Im части p.<br>
<br>
Тогда A[0] равно y0=150  что правильно.<br>
A[5] является максимум тоже верно так как у нас 5 полных синусоид.<br>
 A[5]=4.56 так как у нас есть и отрицательная частота то в два раза меньше. <br>
А еще я так понимаю ошибка порядка 1/5=0.2<br>
B:=2*pi/n*MaxI / 50; 50 - твой шаг <br>
И фазу сам определишь через arctan2.]]></description>
        <author>Pavia</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395002</guid>
        <pubDate>Mon, 12 Oct 2009 16:08:19 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2395002</link>
        <description><![CDATA[ANDLL: Вот<br>
Запускать проект ConsoleApplication1. Там нет одного проекта, но и без него будет запускаться <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2009-10-12T16:09:02+00:00">12.10.09, 16:09</time></span></span><br>
Вот просто код:<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp;Const SOURCEFILE As String = &quot;.......&quot;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;Sub Main()</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Dim rz() As String = SOURCEFILE.Split(CChar(&quot;;&quot;))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Dim p(rz.Length) As AP.Complex</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;For i As Integer = 0 To rz.Length - 1</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;p(i) = Double.Parse(rz(i))</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Next</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;alglib.fft.fftc1d(p, rz.Length)</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Dim a(rz.Length) As Double</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;For i As Integer = 0 To rz.Length - 1</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;a(i) = Math.Sqrt(p(i).x * p(i).x + p(i).y * p(i).y)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Next</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Dim maxI As Integer = 3</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;For i As Integer = 3 To (rz.Length - 1) \ 2</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If a(i) &#62; a(maxI) Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;maxI = i</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Next</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;End Sub</div></ol></div></div></div></div>]]></description>
        <author>ANDLL</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394918</guid>
        <pubDate>Mon, 12 Oct 2009 15:22:52 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394918</link>
        <description><![CDATA[Pavia: Код можно и показать. Лучше проектом.]]></description>
        <author>Pavia</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394837</guid>
        <pubDate>Mon, 12 Oct 2009 14:35:49 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394837</link>
        <description><![CDATA[ANDLL: Положим у меня такой массив точек:<br>
<div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '><br>
142.4831; 142.8679; 143.2807; 143.7201; 144.1843; 144.6715; 145.1797; 145.7068; 146.251; 146.81; 147.3815; 147.9633; 148.5532; 149.1489; 149.7478; 150.3478; 150.9464; 151.5413; 152.13; 152.7104; 153.2802; 153.8367; 154.3784; 154.9027; 155.4076; 155.8913; 156.3515; 156.787; 157.1954; 157.5756; 157.9259; 158.2448; 158.5312; 158.7838; 159.002; 159.1845; 159.3308; 159.4403; 159.5125; 159.5471; 159.5442; 159.5035; 159.4252; 159.3099; 159.1578; 158.9695; 158.7459; 158.4876; 158.196; 157.872; 157.5169; 157.132; 156.7193; 156.2798; 155.8157; 155.3285; 154.8203; 154.2932; 153.7491; 153.1901; 152.6185; 152.0367; 151.4468; 150.8511; 150.2522; 149.6521; 149.0536; 148.4587; 147.87; 147.2895; 146.7199; 146.1633; 145.6217; 145.0973; 144.5924; 144.1088; 143.6485; 143.213; 142.8046; 142.4244; 142.0742; 141.7552; 141.4688; 141.2162; 140.9981; 140.8155; 140.6693; 140.5597; 140.4876; 140.4528; 140.4559; 140.4966; 140.5748; 140.6901; 140.8422; 141.0305; 141.2541; 141.5123; 141.804; 142.128; 142.4831; 142.8679; 143.2807; 143.7202; 144.1843; 144.6715; 145.1797; 145.7068; 146.251; 146.81; 147.3815; 147.9633; 148.5532; 149.1488; 149.7479; 150.3479; 150.9465; 151.5413; 152.13; 152.7104; 153.2802; 153.8367; 154.3783; 154.9027; 155.4076; 155.8913; 156.3516; 156.787; 157.1954; 157.5755; 157.9259; 158.2448; 158.5312; 158.7838; 159.002; 159.1845; 159.3308; 159.4403; 159.5125; 159.5472; 159.5442; 159.5035; 159.4252; 159.3099; 159.1578; 158.9695; 158.7459; 158.4877; 158.196; 157.872; 157.5169; 157.1321; 156.7193; 156.2797; 155.8157; 155.3285; 154.8203; 154.2932; 153.7491; 153.1901; 152.6185; 152.0367; 151.4468; 150.8511; 150.2522; 149.6521; 149.0535; 148.4587; 147.87; 147.2895; 146.7199; 146.1633; 145.6216; 145.0973; 144.5924; 144.1088; 143.6485; 143.213; 142.8046; 142.4244; 142.0741; 141.7552; 141.4688; 141.2162; 140.9981; 140.8155; 140.6693; 140.5597; 140.4876; 140.4529; 140.4559; 140.4966; 140.5747; 140.6901; 140.8422; 141.0305; 141.2541; 141.5123; 141.804; 142.128; 142.4831; 142.8679; 143.2807; 143.7202; 144.1843; 144.6715; 145.1797; 145.7068; 146.2509; 146.8099; 147.3815; 147.9633; 148.5532; 149.1488; 149.7479; 150.3478; 150.9465; 151.5413; 152.13; 152.7105; 153.2802; 153.8368; 154.3784; 154.9027; 155.4076; 155.8913; 156.3515; 156.787; 157.1954; 157.5756; 157.9259; 158.2448; 158.5312; 158.7838; 159.002; 159.1845; 159.3308; 159.4403; 159.5125; 159.5472; 159.5442; 159.5035; 159.4252; 159.3099; 159.1578; 158.9694; 158.7459; 158.4876; 158.196; 157.872; 157.5169; 157.1321; 156.7193; 156.2797; 155.8157; 155.3285; 154.8203; 154.2932; 153.749; 153.1901; 152.6185; 152.0367; 151.4468; 150.8511; 150.2522; 149.6521; 149.0536; 148.4586; 147.87; 147.2896; 146.7199; 146.1633; 145.6216; 145.0973; 144.5924; 144.1087; 143.6484; 143.213; 142.8046; 142.4244; 142.0741; 141.7552; 141.4688; 141.2161; 140.9981; 140.8155; 140.6693; 140.5597; 140.4876; 140.4528; 140.4559; 140.4966; 140.5747; 140.6901; 140.8422; 141.0305; 141.2541; 141.5123; 141.804; 142.128; 142.4831; 142.8679; 143.2807; 143.7202; 144.1843; 144.6715; 145.1797; 145.7068; 146.251; 146.81; 147.3815; 147.9633; 148.5532; 149.1489; 149.7479; 150.3479; 150.9465; 151.5413; 152.13; 152.7104; 153.2802; 153.8367; 154.3784; 154.9027; 155.4076; 155.8913; 156.3515; 156.787; 157.1954; 157.5756; 157.9259; 158.2448; 158.5312; 158.7838; 159.0019; 159.1845; 159.3307; 159.4403; 159.5125; 159.5471; 159.5442; 159.5035; 159.4252; 159.3099; 159.1578; 158.9695; 158.7459; 158.4877; 158.196; 157.872; 157.5169; 157.1321; 156.7193; 156.2798; 155.8157; 155.3285; 154.8203; 154.2932; 153.7491; 153.1901; 152.6185; 152.0367; 151.4468; 150.8511; 150.2522; 149.6521; 149.0535; 148.4586; 147.87; 147.2895; 146.7198; 146.1632; 145.6216; 145.0973; 144.5924; 144.1088; 143.6484; 143.213; 142.8046; 142.4244; 142.0741; 141.7553; 141.4688; 141.2162; 140.9981; 140.8155; 140.6693; 140.5597; 140.4876; 140.4528; 140.4559; 140.4966; 140.5747; 140.69; 140.8422; 141.0305; 141.2541; 141.5123; 141.804; 142.128; 142.4831; 142.8679; 143.2808; 143.7202; 144.1843; 144.6715; 145.1797; 145.7068; 146.251; 146.8099; 147.3815; 147.9633; 148.5532; 149.1489; 149.7478; 150.3478; 150.9464; 151.5413; 152.13; 152.7104; 153.2801; 153.8367; 154.3784; 154.9027; 155.4076; 155.8913; 156.3516; 156.787; 157.1954; 157.5756; 157.9259; 158.2448; 158.5312; 158.7838; 159.002; 159.1845; 159.3308; 159.4403; 159.5125; 159.5472; 159.5441; 159.5035; 159.4252; 159.3099; 159.1578; 158.9695; 158.7459; 158.4877; 158.1961; 157.872; 157.5169; 157.132; 156.7193; 156.2797; 155.8157; 155.3285; 154.8203; 154.2933; 153.7491; 153.1902; 152.6185; 152.0367; 151.4468; 150.8511; 150.2522; 149.6521; 149.0535; 148.4587; 147.87; 147.2896; 146.7199; 146.1632; 145.6216; 145.0973; 144.5924; 144.1088; 143.6485; 143.213; 142.8046; 142.4245; 142.0741; 141.7553; 141.4688; 141.2162; 140.9981; 140.8155; </div></div><br>
Где x(0) берется при y = 50, x(1) при y = 100, x(2) при y = 150, ну вы поняли<br>
Я делаю над ним fftc1d(из алголибовской реализации)<br>
Потом определяю что максимум a(i) достигается при  i = 5<br>
В этой точке a(i) = 2217.1317596732765<br>
Что даже по данным видно - совсем не амплитуда.<br>
Почему?<br>
Код показывать?]]></description>
        <author>ANDLL</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394585</guid>
        <pubDate>Mon, 12 Oct 2009 12:05:47 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394585</link>
        <description><![CDATA[Pavia: <strong class='tag-b'>ANDLL</strong><br>
Так как сетка по x равномерная то можно использовать БПФ (FFT). То берешь свой массив Y. Заносишь в реальную часть. Делаешь преобразование. <br>
http://alglib.sources.ru/fasttransforms/fft.php<br>
<br>
После преобразование будет массив комплексный чисел. Амплитуда вычисляется так <br>
A[i]=sqrt(Re[i]*Re[i]+Im[i]*Im[i])<br>
A[0] даст смещение y0<br>
Ищешь максимум. Начиная со 2 или 3 до n/2<br>
Где максим  A будет соответствовать амплитуде твоей синусоиды. <br>
<br>
В этой точке ArcTan(Re/Im) даст начальную фазу x0 только надо привести в соответствии с x.<br>
i - номер максимального отсчета даст частоту B только надо привести в соответствии с x.]]></description>
        <author>Pavia</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394537</guid>
        <pubDate>Mon, 12 Oct 2009 11:34:00 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394537</link>
        <description><![CDATA[Prince: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Например, измерения в одной точке проводились несколько раз, и каждый раз из-за шума получались разные значения.</div></div><br>
А-а, ещё  неизвестно, каким образом получаются пары значений икс игрек? То есть могут быть единичные измерения, а может многократные, с последующим &quot;усреднением&quot;. <br>
В любом случае, имхо, как раз спектральный анализ позволит исключить хотя бы часть шума, вне гармоник Фурье, на которые приходится полезный сигнал, даже при &quot;небольшом&quot; соотношении сигнал/шум, в то время как вот тот другой метод, который вы обсуждали, скорее всего, загнется. :unsure: <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2009-10-12T11:45:37+00:00">12.10.09, 11:45</time></span></span><br>
<strong class='tag-b'>ANDLL</strong>, литературу можно брать отсюда:<br>
http://dsp-book.narod.ru/books.html]]></description>
        <author>Prince</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394528</guid>
        <pubDate>Mon, 12 Oct 2009 11:28:25 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394528</link>
        <description><![CDATA[ANDLL: Так, а для тех, кто в танке можно?]]></description>
        <author>ANDLL</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394511</guid>
        <pubDate>Mon, 12 Oct 2009 11:14:22 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394511</link>
        <description><![CDATA[shadeofgray: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=284329&view=findpost&p=2394458'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Prince &#064; <time class="tag-quote__quoted-time" datetime="2009-10-12T10:43:42+00:00">12.10.09, 10:43</time></span><div class='quote '>Последнее замечание я не понимаю. Как может быть несколько значений y для одной абсциссы? Каждой точке х соответсвует одна и только одна точка y.</div></div><br>
Например, измерения в одной точке проводились несколько раз, и каждый раз из-за шума получались разные значения.<br>
<br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=284329&view=findpost&p=2394464'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>ANDLL &#064; <time class="tag-quote__quoted-time" datetime="2009-10-12T10:44:54+00:00">12.10.09, 10:44</time></span><div class='quote '>shadeofgray<br>
А есть алгоритмы, которые решают задачу не поиска минимума функции, а поиска нуля(или близкого к нему) функций такого вида? </div></div><br>
Есть алгоритмы решения систем нелинейных уравнений, но я не уверен, что их можно применять в данном случае. И что имеет смысл применять. Существование минимума гарантировано, существование ноля - нет.<br>
<br>
Мне кажется, лучше всего вариант с двухступенчатым алгоритмом - сначала взять БПФ, и выбрать гармонику с максимальной амплитудой (и ещё константу). Затем довести до оптимума при помощи ЛМ.]]></description>
        <author>shadeofgray</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394488</guid>
        <pubDate>Mon, 12 Oct 2009 11:02:13 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394488</link>
        <description><![CDATA[Pavia: А я не согласен преобразование Фурье спокойно работает с неравномерной сеткой. Только быстрое нельзя организовать.<br>По поводу разных значений y при одинаковом x. Оно усреднится.]]></description>
        <author>Pavia</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394464</guid>
        <pubDate>Mon, 12 Oct 2009 10:44:54 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394464</link>
        <description><![CDATA[ANDLL: А ссылку можно на спектральный метод?<br>
http://www.google.ru/search?q=%D1%81%D0%BF%D0%B5%D0%BA%D1%82%D1%80%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B9+%D0%BC%D0%B5%D1%82%D0%BE%D0%B4&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:ru:official&client=firefox показывает мало интересного <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2009-10-12T10:46:00+00:00">12.10.09, 10:46</time></span></span><br>
<strong class='tag-b'>shadeofgray</strong><br>
А есть алгоритмы, которые решают задачу не поиска минимума функции, а поиска нуля(или близкого к нему) функций такого вида?]]></description>
        <author>ANDLL</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394458</guid>
        <pubDate>Mon, 12 Oct 2009 10:43:42 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394458</link>
        <description><![CDATA[Prince: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>К слову сказать, точки и правда лежат на равномерной сетке</div></div><br>
Тогда,<br>
<div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Во-вторых, спектральные методы позволяют выбирать множитель &quot;B&quot; только из конечного диапазона частот, а Левенберг-Марквардт позволяет непрерывно выбирать оптимальный параметр. В-третьих, спектральный анализ совершенно не годится для ситуации, когда нельзя однозначно определить значение функции в точке (есть несколько точек с совпадающими абсциссами, но разными значениями функции) - ситуация, часто встречающаяся в практике.</div></div><br>
Второй пункт может оказаться несущественным, ведь неизвестна пока необходимая точность, кроме того, погрешность измерений и искажения самой синусоиды позволят ли однозначно выбрать &quot;оптимальный&quot; параметр? Я не знаком абсолютно с рассматриваемым методом, так что вполне серьезно интересуюсь. Если, скажем, в выборке кроме основного &quot;тона&quot; присуствуют гармоники? Можно ли подобрать оптимальные параметры?<br>
Последнее замечание я не понимаю. Как может быть несколько значений y для одной абсциссы? Каждой точке х соответсвует одна и только одна точка y. :unsure:]]></description>
        <author>Prince</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394445</guid>
        <pubDate>Mon, 12 Oct 2009 10:35:52 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394445</link>
        <description><![CDATA[shadeofgray: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=284329&view=findpost&p=2394434'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>ANDLL &#064; <time class="tag-quote__quoted-time" datetime="2009-10-12T10:29:51+00:00">12.10.09, 10:29</time></span><div class='quote '>А то результат все равно довольно неправильный(</div></div><br>
Похоже, проблема в свойствах функции - много локальных минимумов, метод попадает в них. Я так понимаю, ему очень сложно менять частоту синуса, т.к. при этом меняется знак функции и проходится большое количество минимумов, в которых мы и застреваем.<br>
<br>
Есть например такой вариант - использовать спектральный метод, предложенный <strong class='tag-b'>Prince</strong>, для определения начального приближения. Затем, если качество не устроит - Левенберг-Марквардт для окончательной подгонки.]]></description>
        <author>shadeofgray</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394438</guid>
        <pubDate>Mon, 12 Oct 2009 10:31:19 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394438</link>
        <description><![CDATA[ANDLL: К слову сказать, точки и правда лежат на равномерной сетке(ну или по крайней мере можно выкинув небольшое число точек ее получить) , чето я сразу не подумал что это важно.]]></description>
        <author>ANDLL</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394435</guid>
        <pubDate>Mon, 12 Oct 2009 10:30:11 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394435</link>
        <description><![CDATA[Prince: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Во-первых, методы, основанные на БПФ, позволяют работать только с точками на равномерной сетке</div></div><br>
Вот в этом и была неясность. Раз сетка неравномерная, со спектром я промахнулся.]]></description>
        <author>Prince</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394434</guid>
        <pubDate>Mon, 12 Oct 2009 10:29:51 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394434</link>
        <description><![CDATA[ANDLL: Заменил код.<br>
Вот так правильный якобиан?<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;s.j(i, 0) = -Math.Sin(B * r.X + X0) REM dF/dA</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;s.j(i, 1) = -A * r.X * Math.Cos(B * r.X + X0) REM dF/dB</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;s.j(i, 2) = -A * Math.Cos(B * r.X + X0) REM dF/dX0</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;s.j(i, 3) = -1 REM dF/dY0</div></ol></div></div></div></div><br>
А то результат все равно довольно неправильный(]]></description>
        <author>ANDLL</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394428</guid>
        <pubDate>Mon, 12 Oct 2009 10:27:44 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394428</link>
        <description><![CDATA[shadeofgray: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=284329&view=findpost&p=2394415'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>0797293 &#064; <time class="tag-quote__quoted-time" datetime="2009-10-12T10:21:19+00:00">12.10.09, 10:21</time></span><div class='quote '>Цитата <br>
А нельзя ли для нахождения параметров синуса применить спектральный анализ? <br>
<br>
Да, совершенно верно, я о том же подумал.<br>
Левенберг-Марквардт в данном случае - это чересчур. </div></div><br>
Мне кажется, это как раз спектральный анализ - не в тему :) Во-первых, методы, основанные на БПФ, позволяют работать только с точками на равномерной сетке - а здесь сетка неравномерная. Во-вторых, спектральные методы позволяют выбирать множитель &quot;B&quot; только из конечного диапазона частот, а Левенберг-Марквардт позволяет непрерывно выбирать оптимальный параметр. В-третьих, спектральный анализ совершенно не годится для ситуации, когда нельзя однозначно определить значение функции в точке (есть несколько точек с совпадающими абсциссами, но разными значениями функции) - ситуация, часто встречающаяся в практике.<br>
<br>
<br>
P.S. Вообще, наверное надо добавить в алгоритм какой-то код для проверки точности вычисления Якобиана/градиента/Гессиана. <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2009-10-12T10:28:50+00:00">12.10.09, 10:28</time></span></span><br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=284329&view=findpost&p=2394422'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>ANDLL &#064; <time class="tag-quote__quoted-time" datetime="2009-10-12T10:23:49+00:00">12.10.09, 10:23</time></span><div class='quote '>Гм.<br>
Только наверное <br>
s.j(i, 1) = - A * r.X * Math.Cos(B * r.X + X0) REM dF/dB</div></div><br>
А, ну да, конечно же вы правы :) я неясно выразился.]]></description>
        <author>shadeofgray</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394422</guid>
        <pubDate>Mon, 12 Oct 2009 10:23:49 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394422</link>
        <description><![CDATA[ANDLL: Гм.<br>Только наверное <br>s.j(i, 1) = - A * r.X * Math.Cos(B * r.X + X0) REM dF/dB]]></description>
        <author>ANDLL</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394420</guid>
        <pubDate>Mon, 12 Oct 2009 10:23:44 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394420</link>
        <description><![CDATA[shadeofgray: <strong class='tag-b'>ANDLL</strong>, неправильно считается Якобиан.<br>
<br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=284329&view=findpost&p=2393736'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>ANDLL &#064; <time class="tag-quote__quoted-time" datetime="2009-10-11T18:49:17+00:00">11.10.09, 18:49</time></span><div class='quote '><br>
s.j(i, 0) = Math.Sin(B * r.X + X0) REM dF/dA<br>
s.j(i, 1) = A * B * Math.Cos(B * r.X + X0) REM dF/dB<br>
s.j(i, 2) = A * Math.Cos(B * r.X + X0) REM dF/dX0<br>
s.j(i, 3) = 1 REM dF/dY0<br>
</div></div><br>
<br>
Во-первых, в каждой строчке потерян минус. Во-вторых, в строке &quot;s.j(i,1)=&quot; есть лишний множитель B.]]></description>
        <author>shadeofgray</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394415</guid>
        <pubDate>Mon, 12 Oct 2009 10:21:19 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394415</link>
        <description><![CDATA[0797293: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>А нельзя ли для нахождения параметров синуса применить спектральный анализ? <br>
</div></div> Да, совершенно верно, я о том же подумал.<br>
Левенберг-Марквардт в данном случае - это чересчур.]]></description>
        <author>0797293</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394396</guid>
        <pubDate>Mon, 12 Oct 2009 10:06:33 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394396</link>
        <description><![CDATA[Prince: Э-э-э... может я не понял суть задачи :unsure: .. в более понятных мне терминах радиотехнических, она звучит так: необходимо определить амплитуду, частоту, начальную фазу и постоянную составляющую синусоидального сигнала, заданного дискретными значениями. Только значения y должны быть &quot;взяты&quot; через равные промежутки времени, а в Вашей формуле вместо времени фигурирует некий x, и о нем ничего неизвестно. Если растояния между соседними значениями x одинаковы, можно вычислить спектр сигнала.]]></description>
        <author>Prince</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394380</guid>
        <pubDate>Mon, 12 Oct 2009 09:52:22 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394380</link>
        <description><![CDATA[ANDLL: Что?)]]></description>
        <author>ANDLL</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394372</guid>
        <pubDate>Mon, 12 Oct 2009 09:44:41 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394372</link>
        <description><![CDATA[Prince: А нельзя ли для нахождения параметров синуса применить спектральный анализ?]]></description>
        <author>Prince</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394331</guid>
        <pubDate>Mon, 12 Oct 2009 09:13:44 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394331</link>
        <description><![CDATA[ANDLL: Гм. Ну а как тогда все таки решать исходную задачу? Нужно найти, получается, глобальный минимум, причем в нем f(x) = 0<br>И посмотрите плз, правильно ли посчитан якобиан]]></description>
        <author>ANDLL</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394173</guid>
        <pubDate>Mon, 12 Oct 2009 07:43:19 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2394173</link>
        <description><![CDATA[Adil: Ну, насколько я помню этот метод, он ищет локальный минимум, а если их несколько (а в реальных многопараметрических задачах - обычно очень много) - в какой он попадет, как раз зависит от начальных условий.]]></description>
        <author>Adil</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2393736</guid>
        <pubDate>Sun, 11 Oct 2009 18:49:17 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2393736</link>
        <description><![CDATA[ANDLL: (спасибо, пока думаю) <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2009-10-11T19:13:04+00:00">11.10.09, 19:13</time></span></span><br>
Тут нужна некоторая помощь.<br>
<br>
У нас выборка x(i), y(i)<br>
Как я понимаю, в качестве f(i) берется (Y - A*sin(B*x(i) + X0) + Y0)^2<br>
Где Y,A,X0,Y0 - переменные от которых зависит функция.<br>
Я взял реализацию на C# и применял ее вот так:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Dim s As New alglib.minlm.lmstate</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Dim sol() As Double = {0.25, 1591.549431, 0, -150} &#39; {0.1, 1000, 0, -120} &#39; &nbsp;&#39;Примерно подобранные начальные значения</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&#39;ReDim sol(results.Count)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;alglib.minlm.minlmfj(4, results.Count, sol, 0.0000001, 0.0000001, 10000, s)&#39; Тут числа взяты наугад</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;While alglib.minlm.minlmiteration(s)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Dim A As Double = s.x(0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Dim B As Double = s.x(1)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Dim X0 As Double = s.x(2)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Dim Y0 As Double = s.x(3)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If s.needf Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Dim _F As Double = 0</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;For Each R As PointF In results</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;_F += (R.Y - (A * Math.Sin(B * R.X + X0) + Y0)) ^ 2</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Next</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;s.f = _F</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Debug.Print(_F.ToString) &#39;<span style='color:red'>ТУТ</span> вывожу значения вычисляемой функции</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If s.needfij Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;For i As Integer = 0 To results.Count - 1</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Dim r As PointF = results(i)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;s.fi(i) = r.Y - (A * Math.Sin(B * r.X + X0) + Y0)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;s.j(i, 0) = Math.Sin(B * r.X + X0) REM dF/dA</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;s.j(i, 1) = A * B * Math.Cos(B * r.X + X0) REM dF/dB</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;s.j(i, 2) = A * Math.Cos(B * r.X + X0) REM dF/dX0</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;s.j(i, 3) = 1 REM dF/dY0</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Next</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If s.needfg Or s.needfgh Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Throw New Exception()</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;End While</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Dim rep As alglib.minlm.lmreport</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Dim X(4) As Double</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;alglib.minlm.minlmresults(s, X, rep)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Dim z As String = &quot;{&quot; &amp; X(0) &amp; &quot;, &quot; &amp; X(1) &amp; &quot;, &quot; &amp; X(2) &amp; &quot;, &quot; &amp; X(3) &amp; &quot;}&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;MsgBox(z)</div></ol></div></div></div></div><br>
Использую вот такой код.<br>
<br>
<br>
Теперь пробую прогнать ее на одной и той же выборке, при разных значениях стартовых параметров<br>
При стартовых параметрах {0.25, 1591.549431, 0, -150} (это довольно близко к правде) алгоритм дает ответ<br>
{0.250000043588598, 1591.54946567717, 2.17883057160585E-08, -150.00006958343}<br>
Что похоже на правду.<br>
При этом последовательные значения функции вот такие:<br>
<div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>175285943.807378<br>
175279093.429274<br>
174998443.565119<br>
155484743.497379<br>
47898495.6142789<br>
43850845.497696</div></div><br>
<br>
Если же взять другие начальные значения, например {0.1, 1000, 0, -120} что уже довольно далеко от истины, получается ответ<br>
{0.0999999859957626, 1000.00000574627, 5.74626982824354E-09, -120.000062631127}<br>
А это совсем неверно<br>
При этом вычисленные значения функции следующие:<br>
<div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>142013745.650736<br>
142008195.060041<br>
141780793.005068<br>
125971771.737748<br>
38809425.2111686<br>
35530193.4296744<br>
</div></div><br>
Вообще какие-то громадные числа получаются. Причина завершения в обоих случаях &quot;relative step is no more than EpsX&quot;]]></description>
        <author>ANDLL</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2393556</guid>
        <pubDate>Sun, 11 Oct 2009 17:01:53 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2393556</link>
        <description><![CDATA[shadeofgray: Это называется &quot;нелинейный МНК&quot;. Используй Левенберга-Марквардта для минимизации суммарной ошибки, т.е. функции вида F=(y(x0)-y0)^2 + ... + (y(xn)-yn)^2<br>
<br>
Реализация метода - либо пакет levmar (c/c++), либо из ALGLIB - http://alglib.sources.ru/optimization/levenbergmarquardt.php <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2009-10-11T17:04:21+00:00">11.10.09, 17:04</time></span></span><br>
Добавление 1: да, минимизация ведется по A,B, xo, yo.<br>
<br>
Добавление 2: в такой постановке задачи у тебя минимизируется ошибка аппроксимации (т.е. ошибка вычисления функции y), а не ошибка нахождения неизвестных параметров. Однако на практике можно исходить из того, что малая ошибка аппроксимации обозначает малую ошибку в параметрах функции.]]></description>
        <author>shadeofgray</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2393538</guid>
        <pubDate>Sun, 11 Oct 2009 16:44:42 +0000</pubDate>
        <title>Как определить параметры синуса?</title>
        <link>https://forum.sources.ru/index.php?showtopic=284329&amp;view=findpost&amp;p=2393538</link>
        <description><![CDATA[ANDLL: Есть результаты физического эксперимента, которые с некоторой ошибкой могут быть представлены в виде функции<br>y = A*sin(B*x + x0) + y0<br>Всего пар x;y около 1000, причем в эксперимент попадает несколько(8-10) периодов функции.<br>Иными словами точки насажены довольно плотно.<br><br>Вопрос - каким образом можно определить A, B, x0, y0 так, что бы точность определения параметров росла с ростом числа известных точек, ну и желательно что бы минимизировалась ошибка(но уже необязательно)?]]></description>
        <author>ANDLL</author>
        <category>Алгоритмы</category>
      </item>
	
      </channel>
      </rss>
	