TransWikia.com

Plotting multiple planes with three variables in 3D using MATLAB

Mathematics Asked on December 31, 2020

I couldn’t figure out, how I could plot three different equations with three variables, namely x,y and z in MATLAB or any other Mathematical Softwares. I know that there’s a way we could plot multiple curves with two variables in MATLAB, but is there any alternative for 3D graphs, as such?

The question is related to Graphical Method in Linear Programming with 3 variables. These are the equations I need to plot in 3D, along with positivity constraints, ie. x=0, y=0 and z=0

x+y+z=450
7x+5y+13z=3000
0.05x+0.1y+0.2z=55

I tried researching a lot about 3D graphical method, but I just found that it’s too difficult to find the solution, hence we use Simplex method, as it is more efficient, but is it possible that this could also be solved by a graphical method, as such.

I also tried using CDF Player for Mathematica, but to no avail. Could anyone tell me if I could plot them manually too, as it seems 3D plotting is too difficult to do by hand.

One Answer

$$x+y+z=450$$ isn't a function (well, it is an implicit curve), while

$$z=450-x-y$$

is. You can plot it using the following code:

x=[0:1:10];
y=[0:1:10]; 
[X,Y]=meshgrid(x,y); 
Z=450-X-Y; 
surf(X,Y,Z) 

You can also remove the positive values of $Z$, by using a little trick:

Z(Z<0)=nan;

Here, you are setting all negative values of $Z$ to Nan. Nan is skipped by Matlab when you plot something.

Answered by the_candyman on December 31, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP