필터 지우기
필터 지우기

quadl problem (Matrix dimensions must agree.).

조회 수: 1 (최근 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

추가 답변 (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