![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/194617/image.png)
implementation of Fibonacci Search
6 ビュー (過去 30 日間)
古いコメントを表示
Hi everybody
I have attached the graph I have. I would like to find the x axis value where the graph has a peak. I wanna use Fibonacci search method to do so. Does anyone help me how can I implement my gaussian fit function in to the search algorithm. my function is : a1*exp(-((x-b1)/c1)^2) + a2*exp(-((x-b2)/c2)^2) + a3*exp(-((x-b3)/c3)^2) + a4*exp(-((x-b4)/c4)^2) + a5*exp(-((x-b5)/c5)^2) + a6*exp(-((x-b6)/c6)^2) where: a1 = 0.3039 ; b1 = 0.1524 ; c1 = 0.3671 ; a2 = 6.593e+13 ; b2 = -495.5 ; c2 = 86.41 ; a3 = 0.245 ; b3 = 0.1098 ; c3 = 0.1452 ; a4 = 0.06194 ; b4 = 0.3992 ; c4 = 0.2167 ; a5 = 0.09388 ; b5 = -0.3931 ; c5 = 0.5412 ; a6 = 0.143 ; b6 = 1.001 ; c6 = 1.158 ; finally, the x axis values are [-1000:100:900] Thanks alot
0 件のコメント
回答 (1 件)
Cesar Antonio Lopez Segura
2018 年 8 月 31 日
Hi, here your code
clc;clear all;close all
x = [-1000:100:900]
a1 = 0.3039 ; b1 = 0.1524 ; c1 = 0.3671 ; a2 = 6.593e+13 ; b2 = -495.5 ; c2 = 86.41 ; a3 = 0.245 ; b3 = 0.1098 ;
c3 = 0.1452 ; a4 = 0.06194 ; b4 = 0.3992 ; c4 = 0.2167 ; a5 = 0.09388 ; b5 = -0.3931 ; c5 = 0.5412 ; a6 = 0.143 ; b6 = 1.001 ; c6 = 1.158 ;
y = a1*exp(-((x-b1)/c1).^2) + a2*exp(-((x-b2)/c2).^2) + a3*exp(-((x-b3)/c3).^2) + a4*exp(-((x-b4)/c4).^2) + a5*exp(-((x-b5)/c5).^2) + a6*exp(-((x-b6)/c6).^2);
plot(x,y)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/194617/image.png)
What do you need ?
2 件のコメント
Cesar Antonio Lopez Segura
2018 年 8 月 31 日
編集済み: Cesar Antonio Lopez Segura
2018 年 8 月 31 日
Hi,
I find your x value where y is maximum, solution x = 900. Here the code:
x=[-1000:100:900];
y= [ 11414437.5016818 11871336.9782804 11630623.7973486 11398895.8639576 ...
10959644.2381691 10765726.6821156 10384820.4947346 9249682.43405169 ...
8478981.20307714 6797569.99418607 4884371.17406437 5647779.88150344 ...
7093070.34791636 8913638.57833148 10192652.3423913 10940080.0617258 ...
11181519.8646888 11879293.5175970 11716479.4871768 11935102.8618483 ];
[val,indx] = max(y);
x( indx )
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195713/image.jpeg)
参考
カテゴリ
Help Center および File Exchange で Get Started with Curve Fitting Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!