Plot 3D Eqns in MATLAB: 5x^2 - 2y^2 + 4x+ 4y -4 +2xy etc

In summary, the conversation discusses the desire to plot three equations in 3D and the attempts made using the surf and ezsurf commands. The expert suggests using the plot3 function and provides an example using vectors A, B, and C.
  • #1
cpeng
2
0
i want to plot these equations in 3d

Eq 1= 5x^2 - 2y^2 + 4x+ 4y -4 +2xy
Eq 2 =x^2 +3x +2y +xy +5
eq 3 = -7x2 +3x -6y +5xy +2

i tried plot3 with 3 matix of x,y,z but i am not satisfied with the result.
please if anyone know how to plot these equations.let me know
thanks in advance
 
Physics news on Phys.org
  • #2
What kind of plot are you trying to make? I'm going to assume a surface plot since you didn't specify. Here is an example using the "surf" command.

x = 1:1:100;
y = 1:1:100;
[X,Y] = meshgrid(x,y);
Z = X.^2.*Y.^3;
surf(X,Y,Z)
 
  • #3
wel these 3 equations will represent 3 coordianted of plot(x,y,z)
combine plot of these equation. i have tried
ezsurf('-5*x.^2 - 2*y.^2 + 2*(x.*y) + 4*y + 4*x -4' ,'x.^2 +3*x +2*y +x*y +5 ','-7*x.^2 +3*x -6*y +5*(x.*y) +2 ');
thats work
 
  • #4
Hi, I have 3 vectors of the same dimensions and want to plot a graph in 3D as surface or volume. I tried but I couldn't. Any body knows?
Vectors arr:
A=[2 5 15 25 30]
B=[0.1 0.2 0.5 0.9 1.0]
C=[1870 1890 1920 2000 2050]

thanks,
PK
 
  • #5
cpeng said:
i want to plot these equations in 3d

Eq 1= 5x^2 - 2y^2 + 4x+ 4y -4 +2xy
Eq 2 =x^2 +3x +2y +xy +5
eq 3 = -7x2 +3x -6y +5xy +2

i tried plot3 with 3 matix of x,y,z but i am not satisfied with the result.
please if anyone know how to plot these equations.let me know
thanks in advance


for this one u can use this,

also mention the x and y values, ie starting and ending as x=1:10; y=1:10;

surf(x,y,Eq 1);
surf(x,y,Eq 2);
surf(x,y,Eq 3);
 
  • #6
pashasrp67 said:
for this one u can use this,

also mention the x and y values, ie starting and ending as x=1:10; y=1:10;
figure;
surf(x,y,Eq 1);
surf(x,y,Eq 2);
surf(x,y,Eq 3);
hold on

so u can try with this
 
  • #7
pkmalik said:
Hi, I have 3 vectors of the same dimensions and want to plot a graph in 3D as surface or volume. I tried but I couldn't. Any body knows?
Vectors arr:
A=[2 5 15 25 30]
B=[0.1 0.2 0.5 0.9 1.0]
C=[1870 1890 1920 2000 2050]

thanks,
PK

u can use plot3 function

as

plot3(A,B,C);
 

1. How do I plot a 3D equation in MATLAB?

To plot a 3D equation in MATLAB, you can use the "meshgrid" function to create a grid of x and y values, and then use the "surf" function to plot the equation using the generated x and y values.

2. Can I plot multiple 3D equations in one plot?

Yes, you can plot multiple 3D equations in one plot by using the "hold on" command after each "surf" function call. This will allow you to plot multiple equations on the same figure.

3. How can I customize the appearance of my 3D plot?

You can customize the appearance of your 3D plot by using various MATLAB functions such as "xlabel", "ylabel", "zlabel", and "title" to add labels and a title to your plot. You can also use the "colormap" function to change the color scheme of your plot and the "view" function to change the viewing angle.

4. Can I save my 3D plot as an image file?

Yes, you can save your 3D plot as an image file by using the "saveas" function and specifying the desired file format (e.g. PNG, JPEG, etc).

5. Is there a way to rotate and zoom in on my 3D plot?

Yes, you can rotate and zoom in on your 3D plot by using the "rotate3d" and "zoom" functions, respectively. These functions allow you to interactively manipulate the viewing angle and zoom level of your plot.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
Replies
6
Views
1K
  • Precalculus Mathematics Homework Help
Replies
16
Views
2K
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
15K
  • Differential Equations
Replies
9
Views
8K
  • Calculus and Beyond Homework Help
Replies
21
Views
2K
Back
Top