Professional Documents
Culture Documents
Electromagnetics Practical: 3rd Year (IV)
Electromagnetics Practical: 3rd Year (IV)
Year
(IV)
Electromagnetics
Practical
1.Point charge
2.Charged circular ring
3.Charged cylinder
4.Charged conducting sphere
5.Uniformly charged non-conducting sphere
Program:
Written Code:
clc
clf
clear
k=9e9
q=2
//r=linspace(0.001,0.01,30)
//E=(k*q)./(r.^2)
//P=(k*q)./(r)
//subplot(121)
//plot2d(r,E,2)
//xtitle("Radial Profile of Electric Field plot due to point
charge","Distance","Electric Field")
//subplot(122)
//plot2d(r,P,5)
//xtitle("Radial Profile of Electric Potential plot due to point
charge","Distance","Electric Potential")
//x=linspace(-20,20,100)
//r=2
//E=(k*q*x)./(4+x.^2)^1.5
//subplot(121)
//plot2d(x,E,2)
//P=(k*q)./((4+x.^2)^1.5)
//xtitle("Radial Profile of Electric Field plot due to circular ring
","Distance","Electric Potential")
//subplot(122)
//plot2d(x,P,2)
//xtitle("Radial Profile of Electric Potential plot due to circular ring
","Distance","Electric Potential")
//L=2
//r=4
//x1=linspace(0.001,r,50)
//x2=linspace(r,2*r,50)
//E1=2*k*L*x1./(r.^2)
//E2=2*k*L*(x2.^-1)
//subplot(121)
//plot2d(x1,E1,2)
//plot2d(x2,E2,3)
//xtitle("Radial Profile of Electric Field plot due to solid non conducting
cylinder ","Distance","Electric Field")
//P2=-2*k*L.*log(x2)
//P1=-2*k*L*log(r)
//subplot(122)
//plot2d(x2,P2,6)
//xtitle("Radial Profile of Electric Potential plot due to solid non
conducting cylinder ","Distance","Electric Potential")
//r=5
//x2=linspace(r,4*r,50)
//x1=linspace(0.001,r,50)
//E1=ones(1,50).*0
//E2=k*q./(x2.^2)
//subplot(121)
//plot2d(x1,E1,2)
//plot2d(x2,E2,5)
//xtitle("Radial Profile of Electric Field plot due to solid conducting
sphere ","Distance","Electric Field")
//P1=ones(1,50)*(k*q./r)
//P2=k*q./x2
//subplot(122)
//plot2d(x1,P1,2)
//plot2d(x2,P2,5)
////xtitle("Radial Profile of Electric Potential plot due to solid conducting
sphere ","Distance","Electric Potential")
r=5
x2=linspace(r,4*r,50)
x1=linspace(0.001,r,50)
E1=k*q.*x1/(r.^3)
E2=k*q./(x2.^2)
subplot(121)
plot2d(x1,E1,2)
plot2d(x2,E2,5)
xtitle("Radial Profile of Electric Field plot due to solid non conducting
sphere ","Distance","Electric Field")
P1=k*q.*(3*(r.^2)-(x1.^2))./(2.*(r.^3))
P2=k*q./x2
subplot(122)
plot2d(x1,P1,2)
plot2d(x2,P2,5)
xtitle("Radial Profile of Electric Potential plot due to solid non
conducting spher ","Distance","Electric Potential")
Output:
1.
2.
3.
4.
5.
Result:
Radial Profile is successfully plotted for the given figures
using Scilab.
Discussion:
1.Here we have assumed the radius and the range of distance
ourselves.
2.Ones command has been used indirectly to set the values of
Electric Field and Potential as a constant value.