quadl problem (Matrix dimensions must agree.).

2 Ansichten (letzte 30 Tage)
Valerio Matteucci
Valerio Matteucci am 25 Mär. 2012
hi all, that is my function that i want to integrate with quadl
function [f] = integranda3(p,px,t,x)
a=p(1)+(1i*p(5)*p(3)*px);
b=sqrt(power(a,2)+((power(p(3),2))*((power(px,2))-(1i*px))));
o11=(1i*px*x);
o12=(p(6)*((power(px,2)-(1i*px))/(a+(b.*(coth((b*t)/2))))));
o1=exp(o11-o12);
o2=exp((((-2*p(1)*p(2))/(power(p(3),2)))*log((cosh((b*t)/2))+((a/b)*sinh((b*t)/2))))+((p(1)*a*p(2)*t)/power(p(3),2)));
f=o1.*o2;
end
where p is a vector of 6 real numbers, px is de parameter of the integration (d/dpx), t is equal to 1 and x is a real number.
when i do
funzione=@(px)integranda3(p,px,t,x);
INT=quadl(funzione,-100,100);
i get an error:
Error using -
Matrix dimensions must agree.
Error in integranda3 (line 12)
o1=exp(o11-o12);
i tried with minus(o11,o12) or with other integration like quadcc but i cant manage to solve this errore.
while .* solve this problem for *, and power solve for ^, it seems that minus dont solve this problem for -
Thank you so much for any help.
V.M.

Akzeptierte Antwort

bym
bym am 25 Mär. 2012
You probably have to fully vectorize your calculations:
.* % for multiply
./ % for divide
.^ % for power

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by