在Matlab上绘制3d不等式 [英] Draw 3d Inequality on Matlab
本文介绍了在Matlab上绘制3d不等式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在努力在Matlab上画一个不等式.我需要使用以下约束和函数来绘制3d空间.我拥有的函数是:
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
这篇关于在Matlab上绘制3d不等式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文