0% found this document useful (0 votes)
17 views

Dcs Matlab Manual Function

Uploaded by

prabhat3karn
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Dcs Matlab Manual Function

Uploaded by

prabhat3karn
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 6

>> r=10

r =

10

>> x=5+3i

x =

5.0000 + 3.0000i

>> x=5+i3
Undefined function or variable 'i3'.

>> y= (5+3i)*5

y =

25.0000 +15.0000i

>> 8/2

ans =

>> 8\2

ans =

0.2500

>> pi

ans =

3.1416

>> format long


>> pi

ans =

3.141592653589793

>> format short e


>> pi

ans =

3.1416e+00

>> format rat


>> pi

ans =

355/113
>> 355/113

ans =

355/113

>> a=[10 4;8 -12]

a =

10 4
8 -12

>> b=[20 ;12]

b =

20
12

>> b/a
Error using /
Matrix dimensions must agree.

>> inv(a).*b

ans =

30/19 10/19
12/19 -15/19

>> inv(a)*b

ans =

36/19
5/19

>> format short


>> ans

ans =

1.8947
0.2632

>> real x

ans =

120

>> real
Error using real
Not enough input arguments.

>> real y
ans =

121

>> clear x
>> clear y
>> x=5+3i

x =

5.0000 + 3.0000i

>> real x

ans =

120

>> clear
>> x= 5+3i

x =

5.0000 + 3.0000i

>> real(x)

ans =

>> angle(x)

ans =

0.5404

>> a=real(x)

a =

>> b=imag(x)

b =

>> [x,y]=cart2pol(a,b)

x =

0.5404

y =

5.8310
>> r= input('enter a number')
enter a number3

r =

>> 5

ans =

>> clear ans


>> p=input('enter an array')
enter an array[2 3 4 5 ]

p =

2 3 4 5

>> q=input('enter a character'


q=input('enter a character'

Error: Invalid expression. When calling a function or indexing a variable, use
parentheses. Otherwise, check for
mismatched delimiters.

Did you mean:


>> q=input('enter a character')
enter a character'p'

q =

'p'

>> clear var


>> workspace
>> clear var
>> speed =menu ('choose speed','LOW','MEDIUM','HIGH');
>> speed =menu ('choose speed','LOW','MEDIUM','HIGH')

speed =

>> speed =menu ('choose speed','LOW','MEDIUM','HIGH');


>> disp(speed)
3

>> fprintf('value of speed is');


value of speed is>> speed

speed =

>> fprintf('value of speed is\n',speed);


value of speed is
>> fprintf('value of speed is %d\n',speed);
value of speed is 3
>> row=[1 2 3.5 -6 7]

row =

1.0000 2.0000 3.5000 -6.0000 7.0000

>> column =[1;2;3.5;-6;7]

column =

1.0000
2.0000
3.5000
-6.0000
7.0000

>> b=[1:2:9]

b =

1 3 5 7 9

>> b=[1:1:10]

b =

1 2 3 4 5 6 7 8 9 10

>> size(b0
size(b0

Error: Invalid expression. When calling a function or indexing a variable, use
parentheses. Otherwise, check for
mismatched delimiters.

Did you mean:


>> size(b)

ans =

1 10

>> b(1,3)

ans =

>> b(1,3)=5

b =

1 2 5 4 5 6 7 8 9 10

>> b(1,3)
ans =

>> var(:,2)

ans =

2
4

>> var(1:2,3)

ans =

4
5

>> var(1,2:1,2)
Index in position 3 exceeds array bounds (must not exceed 1).

'var' appears to be both a function and a variable. If this is unintentional, use


'clear var' to remove the variable
'var' from the workspace.

>> var(1:1)

ans =

>> var(1:2,3)

ans =

4
5

>> var(1:1,2)

ans =

>> sin(pi)

You might also like