How to quantify density of lines in a plot?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Kind all,
I am using a Monte Carlo approach to explore the paramter space of a model. The outputs are different lines that corresponds to the variation of my model's endpoint due to the parameters' variation. Is there a way to realize a contour plot of the density of such realizations?
For the sake of exemplifcation let's assume that my model is the simple function:
func=@(x,m,c)(m*x.^2+c)
x are my data (a fixed vector of inputs to the model), while m and c are parameters that vary within a range.
Now let's assume that:
x=[1:10];
max_m=10;
min_m=0.5;
max_c=max_m;
min_c=min_m;
iterations=1000;
And let our Monte Carlo approach run:
% initialize colors for the plot
cc=hsv(iterations);
% let our model run and plot results:
for k=1:iterations;
m=(max_m-min_m).*rand+min_m;
c=(max_c-min_c).*rand+min_c;
out=func(x,m,c);
hold on
plot(out,'color',cc(k,:));
end
This would result in the following plot:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/155227/image.jpeg)
Is there a way to get an information on how dense/overlapped the lines in the plot in order to either generate a contour or an imagesc plot of the parameter space?
Thanks, all!
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Contour Plots 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!