Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (1)

Walter Roberson
Walter Roberson il 10 Feb 2012
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.

Categorie

Scopri di più su Interpolation in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by