Simpsons method: quad function

4 ビュー (過去 30 日間)
Eric
Eric 2015 年 5 月 11 日
回答済み: Sainath Varikuti 2015 年 5 月 13 日
I've been trying to evaluate the following integral using the quad function. My output is completely blank. Not sure why.
function y = exactintegral(x)
y = (1-(x.^3)).*sin(x) + exp((x.^2)/20);
end
I'm calling it like this:
clear;
Q = quad(@exactintegral,-1,4);
  1 件のコメント
John D'Errico
John D'Errico 2015 年 5 月 11 日
What was Q? I think maybe it is time to start reading the tutorials? I know, real men don't need no steenkin help. The fact that you have a semi-colon after the line where Q is defined, this prevents display of the result. It was still computed though.

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

回答 (1 件)

Sainath Varikuti
Sainath Varikuti 2015 年 5 月 13 日
You may also use 'disp' function to display the value of Q.
>> disp(Q)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by