What is the output of the following code? [code]sin(Inf)~=NaN[/code]

Minh Tung

New member
What is the output of the following code?
Code:
sin(Inf)~=NaN
A. 1
B. 0
C. Error
D. NaN
 
Answer: a
Explanation: sin(Inf) is actually a number since the domain of sine is -infinity to infinity and the range is always -1 to 1. Hence, sin(Inf) is still a number- but it cannot be comprehended hence the value will be returned NaN. But in the above comparison, MATLAB will observe that sin(Inf) is still a number within -1 and 1 and hence, the output is 1.
 

Tìm kiếm

Back
Top