Fixing Error in MATLAB 10a for 3D Plotting

  • MATLAB
  • Thread starter adnan jahan
  • Start date
  • Tags
    Error Matlab
In summary, the conversation is about a program made in MATLAB-7 for 3D plotting. The program uses meshgrid and complex numbers to create a plot. However, when the program is opened in MATLAB-10a, it gives a syntax error due to the use of complex numbers. The solution is to take only the real part of the complex numbers in the program.
  • #1
adnan jahan
96
0
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 anyone help me out to get solve this issue?? I don't want to switch back to same old version of matlab,

thanks
 
Physics news on Phys.org
  • #2
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.
 
  • #3
yessss! thanks Pythagorean for your reply,,

It really works...
 

What is the cause of the "Error in MATLAB 10a for 3D Plotting"?

The error is most likely caused by incorrect syntax or missing data in the code for the 3D plot.

How can I fix the error in MATLAB 10a for 3D Plotting?

The best way to fix the error is to carefully check the code and make sure all syntax is correct and all necessary data is included. You can also try using the debugger tool to identify and fix any errors.

Can I still create a 3D plot even with the error?

It depends on the severity of the error. In some cases, the plot may still be created, but it may not accurately represent the data. It is best to fix the error before creating the plot.

Is the error in MATLAB 10a for 3D Plotting a common issue?

Errors can occur in any programming language, so it is not uncommon to encounter errors while using MATLAB for 3D plotting. However, with careful coding and debugging, these errors can be easily fixed.

Are there any resources available to help troubleshoot and fix the error in MATLAB 10a for 3D Plotting?

Yes, there are many online resources, such as MATLAB documentation and forums, that provide tips and solutions for common errors in MATLAB. You can also consult with other programmers or seek help from a MATLAB expert.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
986
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
928
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
Back
Top