You are on page 1of 7

diary on

array1=[0.0 0.5 2.1 -3.5 6.0; 0.0 -101 -6.6 2.8 3.4; 2.1 0.1 0.3 -0.41.3; 1.1 5.1
0.0 1.1 -2.0]
array1=[0.0 0.5 2.1 -3.5 6.0; 0.0 -101 -6.6 2.8 3.4; 2.1 0.1 0.3 -0.41.3; 1.1 5.1
0.0 1.1 -2.0]
|
{#Error: Unexpected MATLAB expression.
}#
array1 = [0.0 0.5 2.1 -3.5 6.0; 0.0 -101 -6.6 2.8 3.4; 2.1 0.1 0.3 -0.41*.3; 1.1
5.1 0.0 1.1 -2.0]clc
array1 = [0.0 0.5 2.1 -3.5 6.0; 0.0 -101 -6.6 2.8 3.4; 2.1 0.1 0.3 -0.41*.3; 1.1
5.1 0.0 1.1 -2.0]clc

|
{#Error: Unexpected MATLAB expression.
}#
clc
diary tugasyulianti.doc
diary on
clc
diary tugasyulianti.doc
diary on
arrayl[0.0 0.5 2.1 -3.5-6.0; 0.0 -1.1 -6.6 2.8 3.4; 2.1 0.1 0.3 -0.4 1.3; 1.1 5.1
0.0 1.1 -2.0]
arrayl[0.0 0.5 2.1 -3.5-6.0; 0.0 -1.1 -6.6 2.8 3.4; 2.1 0.1 0.3 -0.4 1.3; 1.1 5.1
0.0 1.1 -2.0]
|
{#Error: Unbalanced or unexpected parenthesis or bracket.
}#
clc
diary tugasyulianti.doc
diry on
{#Undefined function or variable 'diry'.
}#
clc
diary tugasyulianti.doc
diary on
arrayl=[0.0 0.5 2.1 -3.5 6.0; 0.0 -1.1 -6.6 2.8 3.4; 2.1 0.1 0.3 -0.4 1.3; 1.1 5.1
0.0 1.1 -2.0]

arrayl =

0 0.5000 2.1000 -3.5000 6.0000


0 -1.1000 -6.6000 2.8000 3.4000
2.1000 0.1000 0.3000 -0.4000 1.3000
1.1000 5.1000 0 1.1000 -2.0000

whos arrayl
Name Size Bytes Class Attributes

arrayl 4x5 160 double

arrayl (1,4)

ans =

-3.5000

arrayl (:,1:2:5)
ans =

0 2.1000 6.0000
0 -6.6000 3.4000
2.1000 0.3000 1.3000
1.1000 0 -2.0000

arrayl ([1,3],end)

ans =

6.0000
1.3000

dog1=24

dog1 =

24

1dog = 9
1dog = 9
|
{#Error: Unexpected MATLAB operator.
}#
do_you_knov_the_way_to_san_jose=5

do_you_knov_the_way_to_san_jose =

_help = 9
_help = 9
|
{#Error: The input character is not valid in MATLAB statements or expressions.
}#
what's_up? = 9
what's_up? = 9
|
{#Error: Unexpected MATLAB expression.
}#
a = 2:3:8

a =

2 5 8

whos a
Name Size Bytes Class Attributes

a 1x3 24 double

b =[a' a' a' ]

b =

2 2 2
5 5 5
8 8 8

whos b
Name Size Bytes Class Attributes

b 3x3 72 double

c b(1:2:3,1:2:3)
{#Undefined function or variable 'c'.
}#
c = b(1:2:3,1:2:3)

c =

2 2
8 8

whos c
Name Size Bytes Class Attributes

c 2x2 32 double

d = a + b(2,:)

d =

7 10 13

whos d
Name Size Bytes Class Attributes

d 1x3 24 double

w = [zeros(1,3) ones(3,1)' 3.5']

w =

0 0 0 1.0000 1.0000 1.0000 3.5000

whos w
Name Size Bytes Class Attributes

w 1x7 56 double

b([1 3], 2) = b([3 1],2)

b =

2 8 2
5 5 5
8 2 8

whos b([1 3],2)


e = 1:-1:5

e =

Empty matrix: 1-by-0


whos e
Name Size Bytes Class Attributes

e 1x0 0 double

arrayl = [1.1 0.0 -2.1 -3.5 6.0 ; 0.0 -3.0 -5.6 2.8 4.3 ; 2.1 0.3 0.1 -0.4 1.3 ;
-1.4 5.1 0.0 1.1 -3.0 ]

arrayl =

1.1000 0 -2.1000 -3.5000 6.0000


0 -3.0000 -5.6000 2.8000 4.3000
2.1000 0.3000 0.1000 -0.4000 1.3000
-1.4000 5.1000 0 1.1000 -3.0000

arrayl(3,:)

ans =

2.1000 0.3000 0.1000 -0.4000 1.3000

arrayl (:,3)

ans =

-2.1000
-5.6000
0.1000
0

arrayl (1:2:3,[3 3 4])

ans =

-2.1000 -2.1000 -3.5000


0.1000 0.1000 -0.4000

arrayl ([1 1],:)

ans =

1.1000 0 -2.1000 -3.5000 6.0000


1.1000 0 -2.1000 -3.5000 6.0000

disp ([10pi = 'num2str(10pi)])


disp ([10pi = 'num2str(10pi)])
|
{#Error: Unexpected MATLAB expression.
}#
value = 10*pi

value =

31.4159

disp(['value = ' num2str(value) ])


value = 31.4159
disp (['value = ' int2str(value)])
value = 31
fprintf(['value = %e\n',value)
fprintf(['value = %e\n',value)
|
{#Error: Unbalanced or unexpected parenthesis or bracket.
}#
fprintf(['value = %e\n',value])
value =
fprintf('value = %e\n', value)
value = 3.141593e+01
fprintf('value = %f\n',value)
value = 31.415927

fprintf('value = %12.4f\n',value)
value = 31.4159
a = [2 1 ; -1 4]

a =

2 1
-1 4

b = [-1 3 ; 0 2 ]

b =

-1 3
0 2

c = [2 ; 1]

c =

2
1

result = a + b

result =

1 4
-1 6

d = eye(2)

d =

1 0
0 1

result = a * d

result =

2 1
-1 4

result = a .* d
result =

2 0
0 4

result = a * c

result =

5
2

result a .* c
{#Error: "result" was previously used as a variable, conflicting with its use here
as the name of a function or command.
See <a href="matlab: helpview([docroot
'/techdoc/matlab_prog/matlab_prog.map'],'function_call_command_syntax')">"How
MATLAB Recognizes Command Syntax" in the MATLAB documentation</a> for details.
}#
result = a .* c
{#Error using <a
href="matlab:matlab.internal.language.introspective.errorDocCallback('times')"
style="font-weight:bold"> .* </a>
Matrix dimensions must agree.
}#
result = a \ b

result =

-0.4444 1.1111
-0.1111 0.7778

result = a .\ b

result =

-0.5000 3.0000
0 0.5000

result = a .^ b

result =

0.5000 1.0000
1.0000 16.0000

11 / (5 + 6)

ans =

11 / 5 + 6

ans =

8.2000

(11 / 5) + 6
ans =

8.2000

11/ (5 + 6)

ans =

3 ^ 2 ^ 3

ans =

729

3 ^ (2 ^ 3)

ans =

6561

(3 ^ 2) ^ 3

ans =

729

round(-11/5) + 6

ans =

ceil(-11/5) + 6

ans =

floor(-11/5) + 6

ans =

diary off

You might also like