필터 지우기
필터 지우기

how do i plot a 3d function and a 2d curve together?

조회 수: 4 (최근 30일)
abril
abril 2020년 5월 4일
댓글: Vetrimurasu 2022년 8월 17일
Hi, i'm new to matlab and i need to plot both: (i don't really know if this is possible but it is worth trying)
1) this 3d function:
f(x,y)= (x^2)/(x^2 - y^2) when |x| ≠ |y|
0 when |x| = |y|
and
2) the curve y=mx where m could be all numbers in ℝ or just some of those numbers.
Both graphs should be seen together.
thx!

채택된 답변

KSSV
KSSV 2020년 5월 4일
m = 100 ; n = 100 ;
x = linspace(-1,1,m) ; % define your range of x
y = linspace(-1,1,n) ; % define your range of y
[X,Y] = meshgrid(x,y) ;
Z = X.^2/(X.^2-Y.^2) ;
Z(X==Y) = 0 ;
m = rand ;
y = m*x ;
surf(X,Y,Z)
hold on
plot3(x,y,zeros(size(x))) ;
  댓글 수: 1
Vetrimurasu
Vetrimurasu 2022년 8월 17일
If the curve doesn't lie on the surface of the plot, how do one calculate the difference between the curve and the surface plot?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by