How do I determine the length of the input vector to quad?
2 ビュー (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (1 件)
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Gamma Functions についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!