Solving Time Delay Integral?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
When trying to integrate this guy:
fD= @(r) (1/(1-rs/r)).*((1-((b^2)./(r.^2)).*(1-(rs/r))).^(-1/2)-1);
I get the error:
Error using /
Matrix dimensions must agree.
Error in @(r)(1/(1-rs/r)).*((1-((b^2)./(r.^2)).*(1-(rs/r))).^(-1/2)-1)
Error in integralCalc/iterateScalarValued (line 315)
fx = FUN(t);
Error in integralCalc/vadapt (line 133)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 84)
[q,errbnd] = vadapt(@AToInfInvTransform,interval);
Error in integral (line 88)
Q = integralCalc(fun,a,b,opstruct);
Error in Bolometric_Flux (line 42)
t=integral(fD,R,Inf);*
This is the full code. Matlab can solve the commented out integral (f) but for some reason it won't work for (fD).
for k=1:length(a);
b=(R/(sqrt(1-u)))*sin(a(k));
%f= @(r) (1./r.^2).*(1/(b(k).^2)-(1./r.^2).*(1-(rs./r))).^(-1/2); %light bending integrand
fD= @(r) (1/(1-rs/r)).*((1-((b^2)./(r.^2)).*(1-(rs/r))).^(-1/2)-1); %time delay integrand
t=integral(fD,R,Inf);
%triangle_phi(i)=2*pi*h*triangle_t(i);
end
R,u and rs are defined in the code.
0 Commenti
Risposte (1)
Rebecca Krosnick
il 23 Dic 2015
How is rs defined? If it is not a scalar, then the error is caused by
1/(1-rs/r)
You cannot divide the scalar "1" by a matrix. You instead need to use element-wise division like you have elsewhere in your code. Specifically, the code would instead be:
1./(1-rs/r)
Otherwise, to troubleshoot the issue, break down your definition of fD into variables. Define a variable for each matrix, and then compare the dimensions of the matrices to ensure they are appropriate for each /, ./, and .* operation.
0 Commenti
Vedere anche
Categorie
Scopri di più su Matrix Computations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!