Nothing on my plot is showing up, anyone know why?
조회 수: 1 (최근 30일)
이전 댓글 표시
figure(1);
clf;
x = [linspace(50,100,1000) linspace(0,50,1000)];
z = -x(1).*x(2).*exp(-(x(1)^2 + x(2)^2)./3);
plot(x,z,'c-');
댓글 수: 0
답변 (2개)
Chad Greene
2016년 5월 31일
Something's there, but it's a straight line of zeros because exp(-(x(1)^2 + x(2)^2)./3) equals zero and cyan is difficult to see.
댓글 수: 2
Walter Roberson
2016년 6월 1일
You define your x as the row concatenation of two linspace() . You extract two values from that linspace and you plot. And the portion you plot is numerically zeros.
[x1,x2] = ndgrid(linspace(-10,10,1000), linspace(-10,10,1000));
z = -x1.*x2.*exp(-(x1.^2 + x2.^2)./3);
surf(x1, x2, z, 'edgecolor', 'none');
댓글 수: 3
Walter Roberson
2016년 6월 1일
You have two independent variables, x and y, and one depending variable, z. You need 3 dimensions to plot the shape it makes. You could, though, instead produce a 2D image that is color coded:
imagesc(z)
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!