Density plot in Matlab

邮差的信 提交于 2019-12-20 07:36:15

问题


What is the Matlab's comparable function to Mathematica's ListDensityPlot? For example

ListDensityPlot[Table[Sin[x y/100], {x, -50, 50}, {y, -50, 50}], 
 DataRange -> {{-50, 50}, {-50, 50}}]

will produce

Thank you.


回答1:


Matlab is different than Mathematica in the sense of vectorized computations vs symbolic computation.

You could do what you'd like by defining a grid of spatial samples for x & y and then sample your function accordingly.

For example:

dx = 0.1;
dy = 0.1;
x = -50:dx:50;
y = -50:dy:50;
[xx, yy] = meshgrid(x,y);
imagesc(sin(xx.*yy/100));


来源:https://stackoverflow.com/questions/37380750/density-plot-in-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!