matlab解方程组遇到的问题 Warning:Warning,solutions may have been lost Warning:Explicit solution我用matlab来解下面方程组,soil*0.1717+veg*0.3474+(1-soil-veg)*0.2318=b1(hang,lie)soil*0.1643+veg*0.3160+(1-soil-veg)*0.2272=b2(hang,lie) s
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 23:08:49
matlab解方程组遇到的问题 Warning:Warning,solutions may have been lost Warning:Explicit solution我用matlab来解下面方程组,soil*0.1717+veg*0.3474+(1-soil-veg)*0.2318=b1(hang,lie)soil*0.1643+veg*0.3160+(1-soil-veg)*0.2272=b2(hang,lie) s
matlab解方程组遇到的问题 Warning:Warning,solutions may have been lost Warning:Explicit solution
我用matlab来解下面方程组,
soil*0.1717+veg*0.3474+(1-soil-veg)*0.2318=b1(hang,lie)
soil*0.1643+veg*0.3160+(1-soil-veg)*0.2272=b2(hang,lie)
soil*0.5848+veg*0.4134+(1-soil-veg)*0.3993=b3(hang,lie)
其中b1,b2,b3为已导入的 150*100矩阵
代码如下
for hang=1:150
for lie=1:100
s=solve('soil*0.1717+veg*0.3474+(1-soil-veg)*0.2318=b1(hang,lie)','soil*0.1643+veg*0.3160+(1-soil-veg)*0.2272=b2(hang,lie)','soil*0.5848+veg*0.4134+(1-soil-veg)*0.3993=b3(hang,lie)');
end
end
运行程序后发现结果是空的,发现s =[ empty sym ],并且有如下警告
Warning:Warning,solutions may have been lost
Warning:Explicit solution could not be found.
> In solve at 140
In linest at 28
请问这是怎么回事呢?
matlab解方程组遇到的问题 Warning:Warning,solutions may have been lost Warning:Explicit solution我用matlab来解下面方程组,soil*0.1717+veg*0.3474+(1-soil-veg)*0.2318=b1(hang,lie)soil*0.1643+veg*0.3160+(1-soil-veg)*0.2272=b2(hang,lie) s
首先,你是三个方程 解两个未知数
另外你的s是不断被改写,存储的是最后一次运行的结果
再者最好在解得时候标明未知数
>> s=solve('soil*0.1717+veg*0.3474+(1-soil-veg)*0.2318=0.5','soil*0.1643+veg*0.3160+(1-soil-veg)*0.2272=1','soil','veg');
>> s
s =
soil:[1x1 sym]
veg:[1x1 sym]
>> s.veg
ans =
-15.289553133853057341963233317480
>> s.soil
ans =
-33.871420004549308298351909675552
>>