Hi Ali,
As per my understanding, using the “ksdensity” function to estimate the data’s density and then using the “contour” or “contourf” function to produce the density plot, you may view the conditional density between two variables in a conditional density plot in MATLAB.
You may have a look at the following MATLAB documentation page for reference:
I hope the above information will be helpful in resolving your query.
Thanks,
Muskan