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.
0 个评论
采纳的回答
bym
2012-3-25
You probably have to fully vectorize your calculations:
.* % for multiply
./ % for divide
.^ % for power
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!