how do i plot a 3d function and a 2d curve together?
    3 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    abril
 el 4 de Mayo de 2020
  
    
    
    
    
    Comentada: Vetrimurasu
 el 17 de Ag. de 2022
            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!
0 comentarios
Respuesta aceptada
  KSSV
      
      
 el 4 de Mayo de 2020
        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 comentario
  Vetrimurasu
 el 17 de Ag. de 2022
				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?
Más respuestas (0)
Ver también
Categorías
				Más información sobre Line Plots en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!