필터 지우기
필터 지우기

How to quantify density of lines in a plot?

조회 수: 4 (최근 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 CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by