Two problems

6 visualizaciones (últimos 30 días)
Y Vineel
Y Vineel el 12 de Mzo. de 2011
Comentada: Rebeca link el 28 de Feb. de 2017
Hi, I am a beginner. I have three probs. 1) How to input the default angle in degrees rather than in radians?
2) I defined a as shown and calculated det(a)
a =
1 2 3
4 5 6
7 8 9
>> det(a)
ans =
6.6613e-016
The ans should be zero but the output is a value very close to zero. But I want a zero. How do I do that?
3) How do I learn MATLAB? Should I read some book or should I just go through the help section one article after another?

Respuestas (2)

Evgeny Pr
Evgeny Pr el 12 de Mzo. de 2011
Hi!
1) Use functions: SIND, COSD, TAND, etc... and convertors RAD2DEG, DEG2RAD.
2) You can use FIX(DET(a)) :)
3) Book - it is always helpful . The more sources of information - the better. :)
  1 comentario
Rebeca link
Rebeca link el 28 de Feb. de 2017
Thanks was useful to me¡

Iniciar sesión para comentar.


Paulo Silva
Paulo Silva el 12 de Mzo. de 2011
1) Matlab functions like sin and others only use radians, you can do the conversion
radians=degrees*pi/180
2) That determinant gives me zero but your result might be a problem with the floating-point relative accuracy, you can round numbers in several ways like:
round(det(a))
floor(det(a))
or use
fprintf('%1.5f',det(a)) %1 is the number of digits on the left and 5 is the number of digits on the right of the .
Your result is very close to the eps
eps
doc eps
3)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by