Info

此问题已关闭。 请重新打开它进行编辑或回答。

How to overcome the rdivider error in the given code?

1 次查看(过去 30 天)
clear all
clc
lambda=[75 150 130 125];
a=[0.50 0.55 0.60 0.50 0.50 0.70 0.70 0.70 0.50 0.50 0.55 0.45 0.70 0.60 0.60 0.80];
b=[189 200 250 315 305 275 345 345 245 245 235 130 345 389 355 370];
c=[150 115 40 122 125 70 70 70 130 130 135 200 70 45 75 100];
d=[23.333 21.022 22.050 22.983 21.313 21.900 23.001 24.003 25.121 22.990 27.010 25.101 24.313 27.119 30.110 22.500];
e=[-1.500 -1.820 -1.249 -1.355 -1.900 0.805 -1.401 -1.800 -2.000 -1.360 -2.100 -1.800 -1.810 -1.921 -1.200 -1.400];
f=[0.016 0.031 0.013 0.012 0.020 0.007 0.015 0.018 0.019 0.012 0.033 0.018 0.018 0.030 0.020 0.040];
B=rand(1,64);
B0=rand(1,16);
Pmin=[0.0005 0.0005 0.0005 0.0005 0.0005 0.0005 0.0005 0.0005 0.0005 0.0005 0.0005 0.0005 0.0005 0.0005 0.0005 0.0005];
Pmax=[0.14 0.10 0.13 0.12 0.25 0.12 0.20 0.18 0.30 0.30 0.30 0.30 0.11 0.20 0.30 0.30];
h=(a.*Pmin.^2+b.*Pmin+c)./(d.*Pmax.^2+e.*Pmax+f);
E=diag(((a+h.*d)./lambda)+B);
D=0.5*(1-((b+h.*e)./lambda)-B0);
P=E\D;
any body please assist me to solve P .
To over come the matlab error rdivider and matlab plus and minus error due to the vectors assigned in the above code are different length

回答(1 个)

Jan
Jan 2013-4-9
There is no way to "overcome" this "problem". Elementwise operations are simply not defined for arrays of different size (except if one of them is a scalar). What do you expect when you dive an [1 x N] vector elementwise by an [1 x M] vector with N~=M ?!

此问题已关闭。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by