Plot surface data which satisfies x/y condition
조회 수: 8 (최근 30일)
이전 댓글 표시
Hello,
I have a function g(x,y). I want to plot the surf data only for areas where condition x + y = 5 is satisfied. How can I do this?
My code so far:
g = matlabFunction(f1);
[x y]=meshgrid(brk,brk);
data = g(x,y);
figure(1)
surf(x,y,data)
댓글 수: 0
답변 (1개)
KSSV
2020년 5월 5일
x = -10:1:10 ;
y = -10:1:10 ;
[X,Y] = meshgrid(x,y) ;
idx = X+Y==5 ;
Z = double(idx) ;
surf(X,Y,Z)
shading interp
colorbar
댓글 수: 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!