# Problem Dependent parameter passing into slicesample

2 visualizaciones (últimos 30 días)
Rashmi Sundareswara el 4 de Mzo. de 2021
Respondida: Prudhvi Peddagoni el 12 de Mzo. de 2021
Is there a way for me to pass a problem dependent parameter into slicesample similar to how it is done for lsqnonlin, i.e.
c=1;
x = lsqnonlin(@(x) myfun(x,c),[1;1]);
function F = myfun(x,c)
F = [ 2*x(1) - exp(c*x(1))
-x(1) - exp(c*x(2))
x(1) - x(2) ];
%hoping to do something like this:
x = slicesample([1;1],N,'pdf',f(x,c),'thin',5,'burnin',1000);
So far it seems like slicesample can only be called with the parameters that it will explore the pdf space with.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Respuestas (1)

Prudhvi Peddagoni el 12 de Mzo. de 2021
Hi,
You can pass additional parameters such as c to the slicesample function like this:
x = slicesample([1;1],N,'pdf',@(x) myfun(x,c),'thin',5,'burnin',1000);
The reason it is throwing error is because there are 3 different functions in myfun. In lsqnonlin function, it returns x such that the sum of squares of these multiple input functions is minimum. But in the case of slicesample function, you need to give a single function.
Hope this helps.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Categorías

Más información sobre Whos en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by