# Truncated distribution applying kernel smoothing

Hello all,
I am trying to define a bivariate probability density function using the kernel smoothing option. I set two bounds (one for each dimension), but the bounds are not kept. I checked in the uq_input variable, there the bounds are correctly stored. I tried to change the bandwidths, but nothing changed. Do you know if there is a way to “force” bounds?
This is the part of the code where I set the marginals:

``````lambda3.Inference.Data = data2D_l3;
lambda3.Marginals(1).Name = 'damp3';
lambda3.Marginals(1).Type = 'ks';
lambda3.Marginals(2).Name = 'omega3';
lambda3.Marginals(2).Type = 'ks';
lambda3.Marginals(1).Options.Bounds = [0.125, 0.281];
lambda3.Marginals(2).Options.Bounds = [77.4, 92.5];
L3 = uq_createInput(lambda3);
``````

Hi Irma,

the bounds should be a field of the marginal, not of `.Options`. So you should replace

with

``````lambda3.Marginals(1).Bounds = [0.125, 0.281];
lambda3.Marginals(2).Bounds = [77.4, 92.5];
``````

This should fix the problem

2 Likes

Thank you very much for your help