Warning message when creating surface plot.
Show older comments
I was working on a code that will produce a scatter plot for the following equation, Z = sin(sqrt(X * X + Y * Y)) / (sqrt(X * X + Y * Y)). When writting it in matlab, I get to the last line of my code and I get this error "Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.112887e-37.". I changed the values in my linspace values thinking that was the issue but I got the same error.
Here is my code:
>> xg = linspace (-10,10,25);
>> [X,Y] = meshgrid (xg,xg);
>> Z = sin(sqrt(X * X + Y * Y)) / (sqrt(X * X + Y * Y + eps));
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.112887e-37.
I do know that in order for a surface plot to prodoce I need to use "surf(X,Y,Z)". I got stuck trying to find a work around for this message. Is it because of my linspace or is it with the formula I am trying to enter?
1 Comment
Leaysia Lampkin
on 22 Jan 2023
Accepted Answer
More Answers (0)
Categories
Find more on Operating on Diagonal Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!