3D plot and contour plot

조회 수: 2 (최근 30일)
Enfa White
Enfa White 2012년 10월 10일
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
Walter Roberson 2012년 10월 10일
편집: Walter Roberson 2012년 10월 10일
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
Walter Roberson 2012년 10월 10일
Change the 1/ to 1./
Enfa White
Enfa White 2012년 10월 10일
I already tried to change / to ./ at the following equations:
p=(1+sin(5*x))-(1./sqrt(8*(sin(x)))); q=(1+sin(5*x))+(1./sqrt(8*(sin(x))));
out=(16*(p+q))./2+p;
When I run it, the empty figure keep opening continuously until I terminate the Matlab program. By the way is there any command that I can enter at the command window to stop this problem? TQ.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by