quadl problem (Matrix dimensions must agree.).

2 ビュー (過去 30 日間)
Valerio Matteucci
Valerio Matteucci 2012 年 3 月 25 日
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
  1 件のコメント
Valerio Matteucci
Valerio Matteucci 2012 年 3 月 25 日
it works thank you i forgot ./

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by