I want to create the 3D plot of the probability density functions of my variable. I have a matrix with dimensions 189x10000, where rows correspond to the time and columns are results of the simulation. Can somebody help me to create a density plot over time? I want my plot to look like this:
A = [1:185]'; % substitute for date vector
K = linspace( -20, 20, 100);
f = zeros(185,100);
xi = zeros(185,100);
r = normrnd(0,1,[185,10000]);
for i=1:185
[f(i,:),xi(i,:)] = ksdensity(r(I,:));
end
a = figure;
meshc(A, K', f')
datetick('x', 'yyyy')
view(85, 50)
set(gca, 'YLim', [-15, 10])
set(gca, 'XLim', [A(1), A(end)])
xlabel('Time')
With this code I get this:
waterfall()
with acontour
on the bottom, rather than ameshc
which does both at once, but lashes the different distributions together along the y-axis. – Rustice