Matlab求解带变量的方程组 [英] Matlab Solve System of Equations with Quantized Variables

查看:245
本文介绍了Matlab求解带变量的方程组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用solve()来求解以下形式的方程组

I am trying to use solve() to solve a system of equations of the following form

eq1=a1x+a2y;
eq2=b1x+b2y;

其中 a1 = .05 表示 x< 5 的值,.1表示5的值

是否有一种方法可以使用求解"来解决?如 sol = solve(eq1,eq2);

where a1 = .05 for values of x<5, .1 for values of 5

Is there a way to solve for this using solve? As in sol = solve(eq1,eq2);

推荐答案

我不确定您要在这里做什么.您能否发布一个真实的示例(带数字)以及您希望输出是什么?

I'm not sure what you're trying to do here. Can you please post a real example (with numbers) and what you would like the output to be?

我认为您正在尝试求解线性联立方程.假设这就是您要尝试做的事情:

I think you're trying to solve linear simultaeneous equations. Assuming that is what you are trying to do:

我建议将所有等式乘以20,以使您的最小量子大小 0.05 变为 1.00 .然后,您的问题变成了整数值线性方程的解决方案.

I would suggest multiplying all of your equations by 20, so that your minimum quanta size of 0.05 becomes 1.00. Your problem then becomes the solution of linear equations for integer values.

请注意,如果系统完全受约束(也就是说,如果要求解的 n 方程具有 n 个独立约束),则只有一个解决方案,它不一定是整数解决方案.例如系统:

Note that if the system is fully constrained (that is, if there are n independent constraints on the n equations you want to solve) then there will only be one solution and it may not necessarily be an integer solution. For example the system:

1 = 2a + 4b
3 =  a +  b

具有解决方案 a = 5.5 b = -2.5 .没有其他解决方案.

has the solution a = 5.5, b = -2.5. No other solution is possible.

对于约束不足的系统,即

For under-constrained systems, i.e.

0 = 3x + y
x > 0

那么将有无数个解,其中一些可能同时具有 x y 都是整数值.(或者可能根本没有整数解.)

Then there will be an infinite number of solutions, some of which may have both x and y being integer values. (Or there may be no integer solutions at all.)

这篇关于Matlab求解带变量的方程组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆