blob: 3af3f6646e6354641502b2dfe22acb849de2762a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
//To Calculate the Work Done in Rotating the Magnet
//Example 36.2
clear;
clc;
M=1.0*10^4;//Magnetic Moment of the Bar Magnet in J/T
B=4*10^-5;//Horizontal Magnetic Field in Tesla
theta1=0;//Initial Angular position of the Magnet
theta2=%pi/3;//Final Angular position of the Magnet
W=-M*B*(cos(theta2)-cos(theta1));//Work Done in Rotating the Magnet
printf("Work Done in Rotating the Magnet = %.1f J",W);
|