1d filter implementation

49 views (last 30 days)
2NOR_Kh
2NOR_Kh on 27 Mar 2022
Edited: Sai Pavan on 19 Oct 2023
I wanna implement this function, f=t^2*exp(-t^2), the exponential part is a gaussian filter and I should finetune mean and variance based on my data, now my question is when gaussian filter is multiplying by a polynomial function how should I convert it to filter?my confusion here is the sigma and varinance of the f function, and how to sode it.

Accepted Answer

Sai Pavan
Sai Pavan on 19 Oct 2023
Edited: Sai Pavan on 19 Oct 2023
Hi,
I understand that you are trying to implement a 1D gaussian filter multiplied by an exponential function.
Please follow the below workflow to implement the custom 1D filter:
  • Create a function handle for the polynomial part, f(t) using the @(t) notation.
  • Create the Gaussian filter using the “normpdf” function and determine the mean (mu) and variance (sigma^2) values that best fit your data as these values control the shape and position of the Gaussian filter.
  • Multiply the polynomial function f(t) with the Gaussian filter
Please refer to the below code snippet that illustrates the implementation of custom 1D gaussian filter:
f = @(t) t.^2 .* exp(-t.^2); % Define the function f(t) = t^2 * exp(-t^2)
mu = 0; % Mean of the Gaussian filter
sigma = 1; % Variance of the Gaussian filter
gaussianFilter = @(t) normpdf(t, mu, sigma); % Define the Gaussian filter
filteredFunction = @(t) f(t) .* gaussianFilter(t); % Combine the polynomial and Gaussian filter
Please refer to the below documentation to learn more about the “normpdf” function:
Hope it helps.
Regards,
Sai Pavan

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!