필터 지우기
필터 지우기

Why y is a complx number? y = x.^(2/3)

조회 수: 3 (최근 30일)
isku
isku 2013년 4월 14일
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])

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 4월 14일
편집: Azzi Abdelmalek 2013년 4월 14일
use
y=abs(x.^(2/3))
You are calculating the roots of negative numbers, they are obviously complex
(-10)^(2/3) is ((-10)^(1/3))^2

추가 답변 (1개)

Walter Roberson
Walter Roberson 2013년 4월 15일
편집: Walter Roberson 2013년 4월 15일
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.

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by