Hello, I am trying to create a surface plot with the following equations but I keep getting the message "Warning: Matrix is singular to working precision." and I'm not sure what to do.
clear
clc
x=(0:1:4);
y=(-2:1:2);
[xx,yy]=meshgrid(x,y);
ox = (-2/pi)*(xx.^3/((xx.^2+yy.^2).^2));
oy = (-2/pi)*((xx.*yy.^2)/((xx.^2+yy.^2).^2));
txy = (-2/pi)*((xx.^2.*yy)/((xx.^2+yy.^2).^2));
zz = sqrt(((ox-oy)./2).^(2)+txy.^(2));
surf(xx,yy,zz);
xlabel('Particle position in the x-axis (m)')
ylabel('Particle position in the y-axis (m)')
zlabel('Electric Potential')
title('Electric Field')
view(45,25)
colormap jet
h = colorbar;
ylabel(h, 'Electric Potential')

 Réponse acceptée

Steven Lord
Steven Lord le 9 Fév 2021

1 vote

See this documentation page for an explanation of the difference between the / and ./ operators.

Plus de réponses (0)

Catégories

En savoir plus sur Color and Styling dans Centre d'aide et File Exchange

Produits

Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by