Fit a sum of basis functions to an array
3 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Kim Winter
on 27 Jun 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!
See Also
Categories
Find more on Image Processing and Computer Vision in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!