Info

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

Matrix size problems after integrating.

조회 수: 1 (최근 30일)
Jay
Jay 2017년 9월 13일
마감: MATLAB Answer Bot 2021년 8월 20일
The following is the code I used
q=10e8:(20e9-10e8)/1000:20e9;
q=q';
s=length(q);
epso = 8.8 *10.^-12;
epsr=5.7;
ro=3.63*(10.^-3);
epsl = 2.5;
ri=1.13*(10.^-3);
copen = (epso/sqrt(epsr)*log(ro/ri));
cload= (epsl/sqrt(epsr)*log(ro/ri));
t = zeros(1,s);
for f = 1:length(q)
fun = @(x)((((((besselj(0,(2*pi*q(f))/(3e8))*x*ro)-besselj(0,(2*pi*q(f))/(3e8))*x*ri)).^2)./x)*freload(x,q));
y(f) = copen*abs(integral(fun,0,Inf,'Arrayvalued',true));
t(f)=(1-y(f))/(1+y(f));
end
plot (q,t);
where the function freload is as follows -
function f = freload(x,q)
epsl=3.4-0.001j;
f=(1./sqrt(epsl-(x.^2))).*(1+exp(-2*1i*2*pi*q./(3e8).*sqrt(epsl-(x.^2))))./((1-exp(-2*1i*2*pi*q/(3e8).*sqrt(epsl-(x.^2)))));
end
The code is giving me an output for another function instead of freload(). The error I get while using it is -
In an assignment A(:) = B, the number of elements in A and B must be the same.
Error in numint (line 14) y(f) = copen*abs(integral(fun,0,Inf,'Arrayvalued',true));
However I have taken the same size for both input and output. Any help would be appreciated.
  댓글 수: 1
James Tursa
James Tursa 2017년 9월 13일
When I run your code, I get a 1001 element column vector on the rhs of that line as the result, which you are then trying to assign to y(f), hence the error.

답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by