Error using ==> asind Argument should be real.
1 次查看(过去 30 天)
显示 更早的评论
can any one tell what this is this error
0 个评论
采纳的回答
John D'Errico
2020-11-24
So what is the problem? It seems the error message states exactly what happened, and why MATLAB sees a problem.
Honestly, it just seems you are typing random commands on the command window, withough thinking of what makes mathematical sense. Eventually, you will type something that fails to produce a valid result. This might be called the inverse monkey phenomenon - a gazzillion chimpanzees might eventually type the works of Shakespeare, clicking on keys at random. However it is far easier for one person to type something at random and get something mathematically meaningless, or at least, meaningless to MATLAB.
In this case, in x1 and y1 we see you trying to compute the inverse cosine of numbers that fall outside of the domain of the acos function (or acosd for that matter.) No problem, because acos can handle any input from the real line, though outside of [-1,1], the result will be complex. That is expected.
Then you tried taking a vector that varies from 0 - 40. Cubed the elemnts, multiplied by 2, for some random reason, and used acosd. Again, no problem. But you should expect that acosd will return complex arguments. But then you tried to compute the asind on that result. Read the error message.
0 个评论
更多回答(1 个)
dpb
2020-11-24
Working as documented...
ACOSD()
Description
Y = acosd(X) returns the inverse cosine (cos-1) of the elements of X in degrees. The function
accepts both real and complex inputs.
For real values of X in the interval [-1, 1], acosd(X) returns values in the interval [0, 180].
For values of X outside the interval [-1, 1] and for complex values of X,
acosd(X) returns complex values.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!