How do I create a 2d surface plot for a function of x and y?
2 次查看(过去 30 天)
显示 更早的评论
This is what I tried
x=linspace(0,10)
y=linspace(0,10)
[xm,ym]=meshgrid(x,y)
fxy=sin(x).*cos(y)
surf(fxy)
but it gives me
Error using surf (line 71)
Z must be a matrix, not a scalar or vector.
Error in problem3 (line 5)
surf(fxy)
0 个评论
回答(1 个)
Kelly Kearney
2020-3-3
编辑:Kelly Kearney
2020-3-3
Change
fxy = sin(x).*cos(y)
to
fxy = sin(xm).*cos(ym)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!