How to quantify density of lines in a plot?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!