Why y is a complx number? y = x.^(2/3)
Ältere Kommentare anzeigen
x = -10:1:10
y = x.^(2/3)
Actually I try to plot y = x^(2/3)but I get warning from Matlab.
I try fplot(x^(2/3)[-10,10])
Akzeptierte Antwort
Weitere Antworten (1)
Walter Roberson
am 15 Apr. 2013
Bearbeitet: Walter Roberson
am 15 Apr. 2013
1 Stimme
Remember, in MATLAB, (2/3) is 0.333333<etc>, a floating point number, rather than being the indicator of taking the square of the third root of the number.
In MATLAB, when you raise a value to a non-integer power, the result x^y is defined as exp( log(x) * y). When x is negative, log(x) is complex. Multiplying a complex number by a floating point number is going to give you a complex number. exp() of a complex number is usually a complex number.
Kategorien
Mehr zu Computational Geometry finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!