Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to overcome the rdivider error in the given code?

조회 수: 1 (최근 30일)
krishnamurthy
krishnamurthy 2013년 4월 9일
마감: MATLAB Answer Bot 2021년 8월 20일
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
Yao Li
Yao Li 2013년 4월 9일
The length of lambda is different with the length of other arrays.

답변 (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