Using quad

1 回表示 (過去 30 日間)
Slo
Slo 2011 年 12 月 6 日
A question is: there is function f(t,a,b) and g(t) where a, b are known variables. Find the area between the curves. I just want to know if I am doing it right, this was one of the old exam questions that could be again.
Is it
Area=quad(@f,a,b)-quad(@g,a,b)
or
fzero(@f(t)-@g(t))=c,d
Area=quad(@f,c,d)-quad(@g,c,d)
I am not getting this at all...
please can someone explain it to me but in a steps so I can understand it
Thank you

採用された回答

Walter Roberson
Walter Roberson 2011 年 12 月 6 日
None of the above.
f(t,a,b) where a and b are constants, is effectively a function in a single variable, t.
g(t) is already a function in a single variable, t.
In order to find the area between the curves, you would need to know the range of t that you were working over. That range is not given anywhere, and there is no reason to expect it to be related to "a" or "b".
The variables "c" and "d" do not appear in the problem definition, so the two answers that involve "c" and "d" must be presumed to be "noise" answers designed to distract.
The correct answer would involve
Area = quad(@(t) f(t,a,b), P, Q) - quad(@g, P, Q)
where P and Q are the unknown limits.
One cannot assume that the limits P and Q should be -inf and +inf, as quad() cannot be used with infinite limits. quadgk() can, though, be given infinite limits; if that is what one assumed then it would be
Area = quadgk(@(t) f(t,a,b) - g(t), -inf, inf)
But of course making an assumption on an exam is a Bad Thing.
  1 件のコメント
Slo
Slo 2011 年 12 月 6 日
Thank you so much sir. so I do not need to worry about a and b at all. I just need to find left and right limit which is P and Q using charts from the question and so on... Thanks again

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

その他の回答 (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