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

Command Window: History

The document discusses the interface of MATLAB software. It has 3 main screens: the command window, workspace, and command history. The command window is used to define variables and run functions. The workspace saves defined variable values. The command history records past commands. Basic commands like clc clear the command window and workspace respectively. Variables can be saved and loaded from files.

Uploaded by

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

Command Window: History

The document discusses the interface of MATLAB software. It has 3 main screens: the command window, workspace, and command history. The command window is used to define variables and run functions. The workspace saves defined variable values. The command history records past commands. Basic commands like clc clear the command window and workspace respectively. Variables can be saved and loaded from files.

Uploaded by

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

-:

. . command window
. workspace current directory
. command history

Current Directory

Workspace

Command window
Command History

-:
view desktop layout Default
-: command window ) (y,x.a
) (run .
-: workspace command window
.workspace
-: current Directory current Directory
-: command history ) (statement command window
command history
y=2, x=2*y,clc -:

-: clc clc command window

command window
-: clear clear command window
workspace .

-:
>> y=6
=y
6
>> save intro
>> clear
>> y
??? Undefined function or variable 'y'.
>> load intro
>> y
=y
6
clear workspace y
** command history
command history command window
-:
- command history command window
.
- command history
.
-
*** ) (pi , i , j ,
>> pi
= ans
3.1416
>> i
= ans
0 + 1.0000i

** i i
.

-:

>> i
ans =
0 + 1.0000i
>> i=7
i=
7
>> i
i=
7
>> p=sqrt(-1)
p=
0 + 1.0000i

-:
>> 3+4
ans =
7
>> ans/0
Warning: Divide by zero.
(Type "warning off MATLAB:divideByZero" to suppress this warning.)
ans =
Inf
>> ans/ans
ans =
NaN
>> 0/0
Warning: Divide by zero.
(Type "warning off MATLAB:divideByZero" to suppress this warning.)
ans =
NaN

NaN mean Not a Number

-:
-: Numeric or array .i
-:

x=2
] Y=[ 1 5 6
]Z=[1 2 ; 3 4
-: String or character .ii hello, ahmed,.. )' ' (

-:
'>> s='hello
=s
Hello

-:vector

.i -:
]>> x=[1 2 3 4 5
=x
5

x -: vector
']>> x=[1 2 3 4 5
=x
1
2
3
4
5
.ii

-:

x= a : s : b

a & b & s
>> x=0 : .5 : 4
=x
4.0000

.iii

3.5000

3.0000

2.5000

2.0000

-:

1.5000

1.0000

0.5000

)x=linspace( a,b,e

a & b & e
)>> x=linspace(0,5,10
=x
Columns 1 through 9

4.4444

3.8889

3.3333

2.7778

2.2222

1.6667

1.1111

0.5556

Column 10
5.0000
-: Length vector

)(x
-:

)>> x=linspace(0,5,10
=x
5.0000

4.4444

3.8889

3.3333

2.7778

2.2222

1.1111

1.6667

0.5556

)>> length(x
= ans
10

-:
)(
]>> x=[1 2 3 4 5
=x
1

) 10(

2 4
>> 2+x

) 7(

>> 2*x
= ans

= ans
4

)(
>> x^2
^ >== ??? Error using

Matrix must be square.


>> x.^2
= ans
25

16

)(
;]>> x=[1 2 3 4 5
;]>> y=[2 5 8 2 3
>> x*y
* >== ??? Error using
Inner matrix dimensions must agree.
>> x.*y
= ans
2 10 24 8 15
*** vectors
square -:
) * & ( ^ & / .
.

-:
;]>> x=[1 2 3 4 5
;]>> y=[2 5 8 2 3
>> s=x*y
* >== ??? Error using
Inner matrix dimensions must agree.
'>> s='x*y
=s
x*y
)>> sv=vectorize(s
= sv

x.*y

g = input (' your age=') -: Input statement

-:
>> g=input('your age=')
your age=20
g=
20

-:
>> x=linspace(0,10.100);
>> y=input('y(x)=');
y(x)=sin(x);
>> plot(x,y)

You might also like