secd vs sec
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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?
0 commentaires
Réponse acceptée
Geoff
le 11 Mai 2012
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Special Functions dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!