필터 지우기
필터 지우기

How do I determine the length of the input vector to quad?

조회 수: 1 (최근 30일)
Daniel
Daniel 2012년 2월 10일
I am trying to use quad instead of sum to obtain a more realistic model. The function for quad is of the form
f(E) * exp(-constant*g(E)*variable) * h(E)
for integration variable E (which I suppose is supplied as a vector by quad), variable set prior to quad execution (I could use a vector or scalar and stick quad in a loop, I suppose: it's a scalar, specifying depth), and functions f g and h which interpolate via interp1 for the input E. I encounter matrix mismatch errors:
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Can you tell me why this error results? My current understanding is that this integration variable E vector supplied by quad is a vector of some length, whose length changes iteratively until the result is accurate to within the default 10^-6 tolerance (or whatever tolerance I would specify). Is it not possible to call functions within quad to interpolate values? I'm trying to interpolate while quad is integrating -- is this possible? It seems a very simple thing.

답변 (1개)

Walter Roberson
Walter Roberson 2012년 2월 10일
f(E) .* exp(-constant .*g(E) .*variable) .* h(E)
What kind of interpolation are you doing inside of f() and h() ? Unless it is at least quintic (5th order), you will not be able to gain any accuracy by interpolating, if I understand the algorithms correctly.

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by