3D plot and contour plot
显示 更早的评论
Question 1)
The following is my function z. Please help me to generate a 3D plot and a contour plot.
function out=z(x,y,n)
p=(1+sin(5*x))-(1/sqrt(8*(sin(x))))
q=(1+sin(5*y))+(1/sqrt(8*(sin(y))))
if fix(n/2)==n/2
out=n*(p+q)
else
out=(n-1)*(p+q)+p
end
x is in the range of 0 to 6, increment 0.1
y also in the range of 0 to 6, increment 0.1
z is in the range of -0.005 to -2.000
回答(1 个)
Walter Roberson
2012-10-10
编辑:Walter Roberson
2012-10-10
0 个投票
0) 0.1 is called the "increment" there
1) see mesh() and contour()
2) length(m) will be 101, or size(m) will show 1 101
3) Yes.
4 个评论
Walter Roberson
2012-10-10
Also, see surf()
The meshgrid() that you had previously was a good start.
Enfa White
2012-10-10
Walter Roberson
2012-10-10
Change the 1/ to 1./
Enfa White
2012-10-10
类别
在 帮助中心 和 File Exchange 中查找有关 Contour Plots 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!