- For the scatter plot, you can use the “scatter” function: Scatter plot - MATLAB scatter - MathWorks India
- To overlay the density on top, you will have to extract the density information from the data using “ksdensity”: Kernel smoothing function estimate for univariate and bivariate data - MATLAB ksdensity - MathWorks India
- Use the “surf” command now to obtain a surface plot of the density information in 3D space: Surface plot - MATLAB surf - MathWorks India
Plot a stochastic process together with a density plot
6 views (last 30 days)
Show older comments
Consider a stochastic process X_t, for 0<t<1. I discretize the time interval (having t = 0.01, 0.02, 0.03..., 0.99), and obatain 100 realized paths for X_t. Now I have 100 "bivariate" data points with each point having coordinate (t, X_t). I want to have a graph with a scatter plot in the bottom illustrating these 100 points (the axis will be t and x), and a 3D density surface on top that shows me the density of my 100 realizations X_t at any given point t for t = 0.01, 0.02, 0.03..., 0.99. Please see attached for an example. I have searched how to do this but it seems like i can only find hist3 which plots a histogram of the density, however I want a surface.
Can anyone kindly help me with this?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1396629/image.png)
0 Comments
Answers (1)
Joel
on 5 Jun 2023
Hi,
Here is a general idea about how you can try to achieve this. Please go through relevant attached documentation:
Note: Use the “hold on” command to overlay the density information on top of the scatter plot.
Hope this helps !!
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!