简体   繁体   中英

Draw 3d Inequality on Matlab

I'm struggling to draw an inequality on Matlab. I need to draw a 3d dimensional space using the following constrains and function.The functions that I have are:

x>=5,000
y>=7,000
z>=3,000
3x+2y+5z<=53,000

And I can't come up with any idea how to do that, help will be very appreciated, thanks!

Depending on how much work you can do before writing code there are different ways to do this. The simplest is this:

x=linspace(5000,53000/3); % create vectors for possible values of each variable
y=linspace(7000,53000/2);
z=linspace(3000,53000/5);
[X,Y,Z]=meshgrid(x,y,z);
I=(X>=5000) & (Y>=7000) & (Z>=3000) & (3*X+2*Y+5*Z<=53000); % combine all constraints
scatter3(X(I),Y(I),Z(I),'filled') % scatter plot, has many options which may prove useful

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM