How to quantify density of lines in a plot?

1 回表示 (過去 30 日間)
Federico
Federico 2016 年 2 月 17 日
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:
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 件)

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by