-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01.Basic_Operations
104 lines (102 loc) · 1.32 KB
/
01.Basic_Operations
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
>> disp("Starting Script")
Starting Script
>> disp("Declaring a variable")
Declaring a variable
>> x=10
x = 10
>> disp(x)
10
>> disp("Adding two variables")
Adding two variables
>> x=10
x = 10
>> y=20
y = 20
>> z=x+y
z = 30
>> disp(z)
30
>> disp("Trignometric Operations")
Trignometric Operations
>> sin(0)
ans = 0
>> sin(45)
ans = 0.85090
>> sin(90)
ans = 0.89400
>> disp("Exponential")
Exponential
>> exp(2)
ans = 7.3891
>> disp("Strings")
Strings
>> str="Hello string"
str = Hello string
>> disp(str)
Hello string
>> x=10
x = 10
>> disp("Testing")
Testing
>> isinteger(x)
ans = 0
>> isfloat(x)
ans = 1
>> x=int(x)
error: 'int' undefined near line 1 column 3
>> x=uint32(x)
x = 10
>> isinteger(x)
ans = 1
>> isfloat(x)
ans = 0
>> x= double(x)
x = 10
>> isinteger(x)
ans = 0
>> x= double(x)
x = 10
>> isinteger(x)
ans = 0
>> isfloat(x)
ans = 1
>> n=30.5
n = 30.500
>> int32(n)
ans = 31
>> isinteger(n)
ans = 0
>> isfloat(n)
ans = 1
>> n=int32(n)
n = 31
>> isfloat(n)
ans = 0
>> isinteger(n)
ans = 1
>> isnumeric(x)
ans = 1
>> isnumeric(str)
ans = 0
>> 10*(20+30)*50
ans = 25000
>> 10*(20+30)*50/20
ans = 1250
>> disp("Root and Power")
Root and Power
>> 8^2
ans = 64
>> 8^10
ans = 1.0737e+09
>> 8^5
ans = 32768
>> 8^(2/3)
ans = 4.0000
>> 8^(1/2)
ans = 2.8284
>> 16^(1/2)
ans = 4
>> 27^(1/3)
ans = 3
>> 2^-3
ans = 0.12500