Error using ==> asind Argument should be real.

2 ビュー (過去 30 日間)
Mustafa Ahmed
Mustafa Ahmed 2020 年 11 月 24 日
回答済み: John D'Errico 2020 年 11 月 24 日
can any one tell what this is this error

採用された回答

John D'Errico
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.

その他の回答 (1 件)

dpb
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.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by