Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Error in MATLAB 10a

  1. Jan 15, 2012 #1
    Dear Fellows,
    I have a program made in MATLAB-7 , about 3D plotting,
    simplest form of program is
    [x,z]=meshgrid(linspace(0,4),linspace(-1,1));
    t=0.1;
    b=1.2;
    w=-1.0;
    k=2+3*i;
    M=4+5*i;
    u1=k*M;
    u=u1.*exp(w*t+i*b*z);

    mesh(u)

    this works properly in matlab-7
    but when I open it in matlab-10a it gives following syntax error
    ??? Error using ==> mesh at 80
    X, Y, Z, and C cannot be complex.

    Error in ==> abc at 9
    mesh(u)

    can any one help me out to get solve this issue?? I don't want to switch back to same old version of matlab,

    thanks
     
  2. jcsd
  3. Jan 15, 2012 #2

    Pythagorean

    User Avatar
    Gold Member

    take only the real part:

    mesh(real(u))

    And compare it to your MATLAB 7 result. It's likely that 7 just automatically takes the real part and doesn't tell you.
     
  4. Jan 16, 2012 #3
    yessss!! thanks Pythagorean for your reply,,

    It really works...
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Error in MATLAB 10a
  1. Matlab Error (Replies: 1)

  2. Error code in Matlab (Replies: 3)

Loading...