![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175014/image.png)
why can't i plot this function? :(
3 views (last 30 days)
Show older comments
Hassan Dehghani
on 29 May 2014
Commented: Hassan Dehghani
on 29 May 2014
I'm trying to plot this function. It gives me the following error.
Warning: Matrix is singular to working precision
I'm using Matlab 2011a.
G=@(x1,x2)(-(1+cos(12*sqrt(x1^2+x2^2)))/(0.5*(x1^2+x2^2)+2));
x=-5:.1:5; y=-5:.1:5; [x1 x2]=meshgrid(x,y);
mesh(x2,x1,G(x1,x2))
0 Comments
Accepted Answer
David Sanchez
on 29 May 2014
Try it this way:
x = -5:.1:5;
y = -5:.1:5;
[x1 x2] = meshgrid(x,y);
G2 = -(1+cos(12.*sqrt(x1.^2+x2.^2)))./(0.5.*(x1.^2+x2.^2)+2);
mesh(x2,x1,G2)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175014/image.png)
More Answers (0)
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!