summaryrefslogtreecommitdiff
path: root/1964/CH4/EX4.21/ex4_21.sce
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /1964/CH4/EX4.21/ex4_21.sce
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '1964/CH4/EX4.21/ex4_21.sce')
-rwxr-xr-x1964/CH4/EX4.21/ex4_21.sce29
1 files changed, 29 insertions, 0 deletions
diff --git a/1964/CH4/EX4.21/ex4_21.sce b/1964/CH4/EX4.21/ex4_21.sce
new file mode 100755
index 000000000..9716cf6d5
--- /dev/null
+++ b/1964/CH4/EX4.21/ex4_21.sce
@@ -0,0 +1,29 @@
+//Chapter-4, Example 4.21, Page 147
+//=============================================================================
+clc
+clear
+ function [polar] = r2p(x,y)//function to convert rectangular to polar
+ polar = ones(1,2)
+ polar(1) = sqrt ((x ^2) +(y^2))
+ polar(2) = atan (y/x)
+ polar(2) =(polar (2)*180)/%pi
+ endfunction
+ function [ rect ] = p2r(r,theta)//function to convert polar to rectangular
+ rect = ones(1 ,2)
+ theta =( theta *%pi) /180
+ rect (1)=r* cos(theta)
+ rect (2)=r* sin(theta)
+ endfunction
+//CALCULATIONS
+I1=p2r(300,0);
+disp(I1);
+I2=p2r(350,30);
+disp(I2);
+I=I1+I2;
+disp(I);
+i3=r2p(I(1),I(2))
+disp(i3);
+mprintf("Thus resultant current is 627.9 A and it leads 300 A by 16 degrees")
+//note:here direct functions for converson are not available and hence we defined user defined functions for polar to rect and rect to polar conversions
+//=================================END OF PROGRAM======================================================================================================
+