You are on page 1of 9

>> b=2.

b =

2.8000

>> a=5

a =

>> c="bonjour";
c="bonjour";
|
Error: The input character is not valid in MATLAB statements or expressions.

>> c="bonjour" ;
c="bonjour" ;
|
Error: The input character is not valid in MATLAB statements or expressions.

>>
>> c="bonjour"
c="bonjour"
|
Error: The input character is not valid in MATLAB statements or expressions.

>> char=c;
Undefined function or variable 'c'.

>> c='bonjour'

c =

bonjour

>> c='bonjour';
>>
>> who;

Your variables are:

a b c

>> c

c =

bonjour

>> a

a =

>> v=[5 20 30 0]
v =

5 20 30 0

>> v'

ans =

5
20
30
0

>> length(v)

ans =

>> v1=[5 20 ] v2=[30 0] v=[v1 v2]


v1=[5 20 ] v2=[30 0] v=[v1 v2]
|
Error: Unexpected MATLAB expression.

>> v[1:2]
v[1:2]
|
Error: Unbalanced or unexpected parenthesis or bracket.

>> u=[1 4 10 16]

u =

1 4 10 16

>> v*u
Error using *
Inner matrix dimensions must agree.

>> w=v*u
Error using *
Inner matrix dimensions must agree.

>> w=v*v'

w =

1325

>> w=u*v'

w =

385

>> w=u'*v

w =
5 20 30 0
20 80 120 0
50 200 300 0
80 320 480 0

>> w=v*u'

w =

385

>> w=u.*v

w =

5 80 300 0

>>
>> for n=2 :1:5 end
>> for n=2:1:5
n
end

n =

n =

n =

n =

>> n

n =

>> n(2)
Index exceeds matrix dimensions.

>> n(0)
Subscript indices must either be real positive integers or logicals.

>> v= [ 5 20 30 0]

v =

5 20 30 0
>> v(0)
Subscript indices must either be real positive integers or logicals.

>> v(1)

ans =

>> v(6)
Index exceeds matrix dimensions.

>> length(v)

ans =

>> size(v)

ans =

1 4

>> w=v.*v

w =

25 400 900 0

>> w=v²
w=v²
|
Error: The input character is not valid in MATLAB statements or expressions.

>> w=v^2
Error using ^
Inputs must be a scalar and a square matrix.
To compute elementwise POWER, use POWER (.^) instead.

>> w=v.^2

w =

25 400 900 0

>> for w=v:v:v.^2


w
end

w =

w =

10
w =

15

w =

20

w =

25

>>
>> who

Your variables are:

ans n v w

>> for 1:1:4


for 1:1:4
|
Error: Unexpected MATLAB expression.

>> for g=1:1:4


g=v.^2
end

g =

25 400 900 0

g =

25 400 900 0

g =

25 400 900 0

g =

25 400 900 0

>> for h=1:1:4


k(h)=v(h)*v(h);
end
>>
>> for h=1:1:4
k(h)=v(h)*v(h)
end
k =

25 400 900 0

k =

25 400 900 0

k =

25 400 900 0

k =

25 400 900 0

>> for h=1:1:4


k(h)=v(h)*v(h);
end
>> k

k =

25 400 900 0

>>
>> m=[1 5 8 7;2 7 0 9 ;1 3 5 8]

m =

1 5 8 7
2 7 0 9
1 3 5 8

>> det(m)
Error using det
Matrix must be square.

>> a=[4 2 ;3 8]

a =

4 2
3 8

>> det(a)

ans =

26

>> a=[4 2 1 ;3 8 3]

a =

4 2 1
3 8 3

>> det(a)
Error using det
Matrix must be square.

>> a=[4 2 1 ;3 8 3;4 8 7]

a =

4 2 1
3 8 3
4 8 7

>> det(a)

ans =

102

>> b=a'

b =

4 3 4
2 8 8
1 3 7

>> s=2+5j

s =

2.0000 + 5.0000i

>> mod(s)
Error using mod
Not enough input arguments.

>> s=2+5j

s =

2.0000 + 5.0000i

>> s=2+5j

s =

2.0000 + 5.0000i

>> arg(s)
Undefined function 'arg' for input arguments of type 'double'.

>> s=2+5j

s =

2.0000 + 5.0000i
>> inv(a)

ans =

0.3137 -0.0588 -0.0196


-0.0882 0.2353 -0.0882
-0.0784 -0.2353 0.2549

>> s=2+5j

s =

2.0000 + 5.0000i

>> d=s'

d =

2.0000 - 5.0000i

>> l=mod(s)
Error using mod
Not enough input arguments.

>> abs(s)

ans =

5.3852

>> arc(s)
Undefined function 'arc' for input arguments of type 'double'.

>> argument(s)
Undefined function 'argument' for input arguments of type 'double'.

>> arg(s)
Undefined function 'arg' for input arguments of type 'double'.

>> ang(s)
Undefined function 'ang' for input arguments of type 'double'.

Did you mean:


>> angle(s)

ans =

1.1903

>> angl(s)
Undefined function 'angl' for input arguments of type 'double'.

Did you mean:


>> angle(s)

ans =

1.1903
>>

You might also like