Determining electric field from electrostatic potential
Show older comments
I am trying to determine Elecric field from 2D electrostatic potential. E = -grad (V); I have a 2D matrix of (V). When I am writing [Ex Ey]=-imgradient(V,'sobel') I am getting error as Error using '-' , too many arguments. Someone kindly help to correct it.
Accepted Answer
More Answers (2)
Shivam
on 3 Sep 2024
Hi Somnath,
I see that you are encountring the error while calculating electric field from 2D electric potential.
In vector calculus notation, the electric field is given by the negative of the gradient of the electric potential, E = −grad V.
You can follow the below workaround to correctly calculate the Electric Field:
% Compute the gradient components
[Ex, Ey] = imgradient(V);
% The electric field is the negative gradient of the potential
Ex = -Ex;
Ey = -Ey;
I hope this resolves the issue.
Regards,
Shivam
Eliezer
on 17 Oct 2024
0 votes
See more here:
Categories
Find more on Creating and Concatenating 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!