This could be a very complicated question depending on how far you want to take it. Here's a simple attempt. You can simulate values of f by simulating values of its inputs. Then you can compute a histogram of the results. For example:
a = 10 + 2*randn(1000,1); % 1000 normal values, mean 10, std dev 2
b = pi*rand(1000,1); % 1000 values uniform between 0 and pi
f = @(a,b) a.*sin(b); % sample f function
e = f(a,b); % simulate f
hist(e,40); % histogram, similar to density function
This code doesn't make use of any toolbox, but you can find functions to generate random numbers from other distributions in the Statistics Toolbox.
