Print a Simple Function: How to Print x^2/3 in Just a Few Steps

  • Context: MATLAB 
  • Thread starter Thread starter robax25
  • Start date Start date
  • Tags Tags
    Function
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
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)
 
on Phys.org
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: