Matlab中的密度图 [英] Density plot in Matlab

查看:143
本文介绍了Matlab中的密度图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Matlab与Mathematica ListDensityPlot的可比功能是什么?例如

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}}]

会产生

谢谢.

推荐答案

Matlab在矢量化计算与符号计算的意义上与Mathematica不同.

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

您可以通过为x&定义一个空间样本网格来做自己想做的事情. y,然后相应地对函数进行采样.

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

例如:

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

这篇关于Matlab中的密度图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆