# implementation of Fibonacci Search

2 visualizzazioni (ultimi 30 giorni)
engineer il 31 Ago 2018
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 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (1)

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 CommentiMostra NessunoNascondi Nessuno
engineer il 31 Ago 2018
Well, based on my data, i used gaussian fit and tried to obtain an equation of my graph. My aim is to find the distance in x axis given a maximum point of the function. My data: 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
I dont get it why the equation I got from gaussian fit seems fine as I have attached, and does not seem correct when I plot it using the function and x values. I hope you got it what I am triying to do. Please let me know if anything is not clear.
Modificato: Cesar Antonio Lopez Segura il 31 Ago 2018
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 )

Accedi per commentare.

### Categorie

Scopri di più su Get Started with Curve Fitting Toolbox in Help Center e File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by