implementation of Fibonacci Search
조회 수: 10 (최근 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)
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 )
참고 항목
카테고리
Help Center 및 File Exchange에서 Curve Fitting Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!