summaryrefslogtreecommitdiff
path: root/1964/CH5/EX5.1
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /1964/CH5/EX5.1
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/CH5/EX5.1')
-rwxr-xr-x1964/CH5/EX5.1/ex5_1.sce30
1 files changed, 30 insertions, 0 deletions
diff --git a/1964/CH5/EX5.1/ex5_1.sce b/1964/CH5/EX5.1/ex5_1.sce
new file mode 100755
index 000000000..cdc658298
--- /dev/null
+++ b/1964/CH5/EX5.1/ex5_1.sce
@@ -0,0 +1,30 @@
+//Chapter-5, Example 5.1, Page 157
+//=============================================================================
+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=r2p(7,-5);
+disp(I1);
+I2=r2p(-9,6);
+I2(2)=I2(2)+(180);//this belongs to quadrant 2 and hence 180 degrees should be added
+disp(I2);
+I3=r2p(-8,-8);
+I3(2)=I3(2)+(180);//this belongs to quadrant 3 and hence 180 degrees should be added
+disp(I3);
+I4=r2p(6,6);
+disp(I4);
+//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======================================================================================================
+