secd vs sec

4 ビュー (過去 30 日間)
David C
David C 2012 年 5 月 11 日
x=-89.5:0.001:89.5; y=1./secd(x); trapz(x,y) Gives 114
AND
x=-pi/2:0.001:pi/2; y=1./sec(x); trapz(x,y) Gives 2
Why?

採用された回答

Geoff
Geoff 2012 年 5 月 11 日
Because your data ranges are different.
The area underneath the curve spanning -89.5:0.001:89.5 is approximately 180/pi times larger than the area underneath the curve spanning -pi/2:0.001:pi/2.
Your answers are correct, except you are using two different ranges. Surely the comparable range in degrees is -90:0.001:90
Note also that the step size for your degrees makes that calculation much more accurate than your radians range (which is using the same step size).
[edit] Compare apples with apples...
xd = -90:0.001:90;
yd = 1./secd(xd);
xr = xd * pi / 180;
yr = 1./sec(xr);
% Use radians for x-axis in both calculations
zd = trapz(xr, yd)
zr = trapz(xr, yr)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpecial Functions についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by