Azzera filtri
Azzera filtri

Fit a sum of basis functions to an array

2 visualizzazioni (ultimi 30 giorni)
Anshuman Borgohain
Anshuman Borgohain il 23 Giu 2018
Can someone give me an idea how do I fit a sum of basis functions to an array? The context is image analysis and I am trying to find a convolution kernel from one image to the other. I am able to form the basis set, but unable to move forward from there on. P.S. I am very new to MATLAB.

Risposte (1)

Kim Winter
Kim Winter il 27 Giu 2018
Hi, I have included an example below that might be pretty different than yours, but you can put your own values in. Below, I first create a function handle, with an array of my functions(in this case, sin(x) and cos(x)^2). I then create a series of inputs, x, using linspace. This creates 1000 equally spaced points between 1 and 1000. I then run my inputs through. Finally, I add my answers together.
%define basis functions using function handles
basis_funcs=@(x)sin(x);
basis_funcs2= @(x)(cos(x).^2);
%evenly spaced input array
inputs=linspace(1,1000,1000);
%input arrays into functions
output=basis_funcs(inputs);
output2=basis_funcs2(inputs);
%add outputs
outputfin=output+output2;
Hopefully this is what you're looking for!
  1 Commento
Anshuman Borgohain
Anshuman Borgohain il 28 Giu 2018
Dear Kim,
Thank you for your reply. I understand that you are showing how to create the basis set and then add them. But my goal is to fit a sum of the basis functions to some data and get the coefficients of fit. Its like:
mydata = a*basis_funcs + b*basis_funcs2 + ..........
and I need a and b using some minimisation.
Best,
Anshuman

Accedi per commentare.

Categorie

Scopri di più su Descriptive Statistics 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