quadl problem (Matrix dimensions must agree.).

1 次查看(过去 30 天)
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.

采纳的回答

bym
bym 2012-3-25
You probably have to fully vectorize your calculations:
.* % for multiply
./ % for divide
.^ % for power

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by