Learning Signal & System Using Matlab (Part_01)

Posted on at


Both a) & b) are different .

In (a) “y” and “x” are devided first and then multiply by “z” ;

In (b) “x” and “z” multiplied first and then devide “y” by ans ;

x = 4 ;

y = 12 ;

z = -2 ;

sqrt(x)             ans = 2

sqrt(y)             ans = 3.4641

sqrt(z)             ans = 0 + 1.4142i

format long

sqrt(x)           ans = 2

sqrt(y)            ans = 3.464101615137754

sqrt(z)           ans = + 1.414213562373095i

format short e

sqrt(x)            ans = 2

sqrt(y)           ans = 3.4641e+00

sqrt(z)           ans = 0 + 1.4142e+00i

x = 4 ;

y = 12 ;

z = -2 ;

sin(pi/3)     ans = 8.6603e-01

cos(pi/4)       ans = 7.0711e-01

tan(pi/2)       ans = 1.6331e+16

asin(0)       ans = 0

log(x)         ans =1.3863e+00

exp(y)         ans = 1.6275e+05

abs(z)         ans = 2

Result

Tan (pi/2) is not equal to infinity in matlab .

Method_01

a = [1,2,3,4,5,6]                

                         a = 1     2     3     4    5     6

Method_02

a = [1:6]                              

                        a =1     2     3     4     5     6

A = [ 1 1 1 1 ; 2 -1 0 1 ; 0 0 0 1 ; -1 1 1 0 ]

A =

     1     1     1     1

     2   -1     0     1

     0     0     0     1

   -1     1     1     0

A = [ 1 1 1 1 ; 2 -1 0 1 ; 0 0 0 1 ; -1 1 1 0 ];

A'

ans =

     1     2     0   -1

     1   -1     0     1

     1     0     0     1

     1     1     1     0

A = [ 1 1 1 1 ; 2 -1 0 1 ; 0 0 0 1 ; -1 1 1 0 ]

A =

     1     1     1     1

     2   -1     0     1

     0     0     0     1

   -1     1     1     0

linspace(-pi/2,pi/2,15)

ans =

Columns 1 through 6

   -1.5708   -1.3464   -1.1220   -0.8976   -0.6732   -0.4488

Columns 7 through 12

   -0.2244         0   0.2244   0.4488   0.6732   0.8976

Columns 13 through 15

   1.1220   1.3464   1.5708



About the author

Ihtasham-Zahid

I am student of Electronics Engineering in International Islamic University Islamabad.

Subscribe 0
160