How do I print x^(2/3) in MATLAB?

  • Context: MATLAB 
  • Thread starter Thread starter robax25
  • Start date Start date
  • Tags Tags
    Function
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
6 replies · 1K views
robax25
Messages
238
Reaction score
3
how I print x^2/3

Here is my code
Matlab:
x=-100:100;
y=x.^(2/3),
plot(x,y)
 
Physics news on Phys.org
What is your question? What result do you get when try what you wrote?
 
Matlab does not display right graph. I think that it displays wrong. my question is that how do I print y=x.^(2/3)?
 
robax25 said:
Matlab does not display right graph. I think that it displays wrong.
It is hard to help you without more details.

You do realize that ##x^{2/3}## is problematic for ##x <0##?
 
I can't see anything wrong with your code.

Did you notice the bit where Matlab states that it ignores the imaginary part of the answer when plotting?
What you are effectively doing is this
Matlab:
x=-100:100;
y=real(x.^(2/3))   %%Real part only
plot(x,y)
 
Last edited by a moderator: