Documente Academic
Documente Profesional
Documente Cultură
2. Ceil
Y = ceil(X) rounds each element of X to the nearest integer greater than or equal
to that element.
Y = ceil(t) rounds each element of the duration array t to the nearest number of
seconds greater than or equal to that element.
3. Sin
4. Cos
5. Tan
6. Csc
7. Sec
8. Cot
9. Log
Natural logarithm
Y = log(X)
10. Sqrt
Square root
B = sqrt(X)
B = sqrt(X) returns the square root of each element of the array X. For the
elements of X that are negative or complex, sqrt(X) produces complex results.
11. nthroot
OUTPUT
>> A=rand(4,4)
A=
0.8147 0.6324 0.9575 0.9572
0.9058 0.0975 0.9649 0.4854
0.1270 0.2785 0.1576 0.8003
0.9134 0.5469 0.9706 0.1419
>> B=round(A)
B=
1 1 1 1
1 0 1 0
0 0 0 1
1 1 1 0
>> C=floor(A)
C=
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
>> D=ceil(A)
D=
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
>> E=fix(A)
E=
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
>> F=randn(4,4)
F=
-0.1241 0.6715 0.4889 0.2939
1.4897 -1.2075 1.0347 -0.7873
1.4090 0.7172 0.7269 0.8884
1.4172 1.6302 -0.3034 -1.1471
>> G=floor(F)
G=
-1 0 0 0
1 -2 1 -1
1 0 0 0
1 1 -1 -2
>> H=ceil(F)
H=
0 1 1 1
2 -1 2 0
2 1 1 1
2 2 0 -1
>> I=fix(F)
I=
0 0 0 0
1 -1 1 0
1 0 0 0
1 1 0 -1
>> plot(fun)
>> a
a= 2
>> w
w =314.1593
>> t=0:0.01:100;
>> fun=a*sin(w*t);
>> plot(fun)
>> plot(t,fun)
>> t=0:0.1:100;
>> fun=a*sin(w*t);
>> plot(fun)
>> plot(fun,t)
>> t=0:0.001:100;
>> fun=a*sin(w*t);
>> plot(fun)
>> t=0:0.001:1;
>> fun=a*sin(w*t);
>> plot(t,fun)
>> fun=a*sin(w*t);
>> fun=a*cos(w*t);
>> plot(t,fun)
>> subplot(2,2,1)
>> subplot(2,2,1);plot(t,fun)
>> hold;
Current plot held
>> subplot(2,2,1);plot(t,fun)
>> hold
Current plot held
>> subplot(2,2,2);plot(t,fun)
>> y=a*cos(w*t);
>> subplot(2,2,1);plot(t,y)
>> hold
Current plot held
>> subplot(2,2,2);plot(t,fun)
>> z=a*tan(w*t);
>> hold
Current plot held
>> subplot(2,2,3);plot(t,z)
>> subplot(3,2,1);plot(t,y)
>> hold
Current plot held
>> subplot(3,2,2);plot(t,fun)
>> hold
Current plot held
>> subplot(3,2,3);plot(t,z)
>> hold
Current plot held
>> p=1./(a*sin(w*t));
>> subplot(3,2,4);plot(t,p)
>> hold
Current plot held
>> q=1./(a*cos(w*t));
>> subplot(3,2,5);plot(t,q)
>> r=1./(a*tan(w*t));
>> subplot(3,2,6);plot(t,r)
>> N=rand(3,3)
N=
0.2769 0.8235 0.9502
0.0462 0.6948 0.0344
0.0971 0.3171 0.4387
>> J=log(N)
J=
-1.2840 -0.1942 -0.0511
-3.0754 -0.3641 -3.3684
-2.3317 -1.1485 -0.8238
>> K=log10(N)
K=
-0.5576 -0.0844 -0.0222
-1.3356 -0.1581 -1.4629
-1.0126 -0.4988 -0.3578
>> f=1:0.001:100;
>> fun1=log(f);
>> plot(f,fun1)
>> plot(f,fun1)
>> subplot(1,2,1);plot(f,fun1)
>> hold
Current plot held
>> fun2=log10(f);
>> subplot(1,2,2);plot(f,fun2)
>> sqrt(4)
ans = 2
>> sqrt(683458)
ans = 826.7152
>> nthroot(16,4)
ans = 2
>> nthroot(2385214,547)
ans = 1.0272
>> nthroot(68957627517963537,43275465)
ans = 1.0000