Professional Documents
Culture Documents
ن ذب
ﺍﻋﺪﺍﺩ
1
ااد م
ن ذب
!" #$ %
&' &
.(
#$ % ) ( ( * #$ +
!
0 '" E
! #$ 2) 0 +? Math Works C D> 0 #
*
.#=
#( 2")
2 #$ %6 2(
# 4 !@
! !6 ? - !@ 0 &) E
! #$ < 0 2
: X + 2Y = 24 12X – 5Y = 100
(
0-
- ") <
> $
'
> #4 ,'5 !6 &=- !@ 0 <
.
- C B
,
B
$ !
&C
+? 2"-
E
0 -" # .") B #$ < :
0
66
:% 6 .% *@
4 +
=) !
.# " +
! 0 !6
!" "-
= (: 5
B
) # *
*
!4' !) * +? % 6$ B &)= % - 2"
-
Algebric Equations
5- !
= 2
Integration !
differentiation
- 0 ! #
"- Differential Equations "4' 5- 2
2
ااد م
ن ذب
.( =? 0 6
Aerospace and Defense,
=?
4 =?1-
Simulink&2-
Control System Using the Matlab N 3-
Signal Application Using Matlab N &C =?4-
Digital Signal Processing Using Matlab N &C ")5-
Numerical Application Using Matlab N = 4 6-
Image Processing Applications Using Matlab N
- =?7-
Radio Frequency Applications Using Matlab N
=?8-
Mechanical Applications Using Matlab N =?9-
Radar Applications Using Matlab N =?10-
Robots Applications Using Matlab N
=?11-
Electronics Applications Using Matlab N
=?12-
Semiconductors Applications Using Matlab N
AC =?13-
Automotive Applications Using N ) #$ =?14-
Matlab
Aerospace and N 1
E$
,4'
") #$ =?15-
Defense Applications Using Matlab
Communication Applications Using Matlab N 5 =?16-
3
ااد م
ن ذب
#
# !6 (- !- # (
!@
0 )
A : !) @2-
04 4
! workspace #$ 7
&O ( #") !C #
.LLLLLLL =?
&
?" !@
@5 !
0 #P
" !" =" 0 -
)
#: 4 /@
" 4-
sum , sine , cosine & complex arithmetic !LLL6
4
ااد م
ن ذب
* (
.
5
ااد م
ن ذب
:Current Directory!- 2-
#$
Work"
* A$
1 #@=" .B$ !- 1 # "
#$ !6
1
* $
# !
" !( !7> 0 0 #@=" .*
#' 7(.m). @ B'" Q$ 1 J? ? "
'" $
"Enter"< .") = ) 7 !-'
&C 2
!= < >
&
#$ 5 - 0
2 !- 0
: WorkSpace!- !
3-
!
.7 ! & =
('- # 7 , !
!
#$
.5- 0 2 P
5- #$ &C B->
7"
= I' > &)
4 0 0 .
) B"
#7 2 !- !
/ &C * J"7
!
R$>
:Command "- /C4-()
(
(x,y,z ) !6 7 , 2 S- #-
History
"- &$ #$ ' # = "- $
!
&$ A #$
. Q'
#$
< .") ?74 ?=$ (
/("-' &)>
!6
6
ااد م
ن ذب
7
ااد م
ن ذب
)> J? 0) 2
B$ &
!
.> !
$4
> Q Matlab L * 0N$
.0- N ('
&$ ! 0 M-File '" !
A
: # &) + ? !
#$ /-
m-files #$ '
. ' B 1 B'
/- #$
0
0 •
. $ B !' 5
+?= 0 0
0
0 •
. / 31 <
5 0 •
. < B)> 0
/ 0 •
.&C /" CC .")
Run 0 B"7C 0
B 6 * *"
)
U∞ A
$
'
1C- = Floor
∞ A
$
'
1C- = Ceil
' A
1C- =
Fix
.?=$ Q .") !
,7
= #-
:6"6 !
'
.
<
Sin
.
<"
Cos
.
< ! Tan
.
<" ! Cot
.
<
"- 1@ =
< $- Asin
.
<
"- 1@ =
< $- Acos
.
< !
"- 1@ =
< $- Atan
.
< !
"- 1@ =
< $- Acot
csc I
- Acsc
sec I
- Asec
9
ااد م
ن ذب
sinh I
- Asinh
cosh I
- Acosh
(1U3) !
:
!
'
x
e Exp
#-
Sqrt
="? =
Abs
) 2C = Gcd
7 2C /)4 Lcm
.- =
Max
:7 =
Min
.=" Q #" ="? = Mod
.=" Q # Rem
.2 I
P
" log2
(10I
)1C- I
P
" log10
.
4 Factorial
." " )
== ) 0 ) 0
Complex
.#" -" J$ $- Conj
- 0 #" ,<
Imag
- 0 #== ,<
Real
10
ااد م
ن ذب
0 B
!
$
'
(
S) #$ ) >
& & Matlab * 2"
.") ="- D> > .> $4
!C 2" 2 .> $4 - 66 !C
* =
.B$ &< 0 Matlab #$ $
'
4 > 0
2
()?
:(
(=
7
? 0
7 !6 .") ) !@
Matlab
'
. 2-D- @6 ? " plot
.- #66 " Plot3
% !C 0
" #
0
" + 0 meshL C
#66 "
surf
.3-D -
% !C 0
" #
0
" + 0 meshc L C
"
Surfc
.3-D - #66
.C !C .") 3-D 66 65
.") " mesh
!
-
A 0 !
04 @6
.")
=
ezplot
.0
.3-D - #66 #$ (
/- meshgrid
hold on ("-' 8 . 0 6 "- A =
hold
hold off ($= 2 -
,C
. .") 0
) Title
. " #=$
Xlabel
. " 1
-
Ylabel
." 86 -
Zlabel
.( =
) .") C grid on
.
?> #$ "'
&) S- subplot
. .") J"- 1 Text
. (7 ,) V' Legend
.!C A
> 1 0 view
.
!
? axis
.- 66
0- #$ " ?? !- contour
: 0
0 6
11
ااد م
ن ذب
B C M G Y K W R <
UU U. : U <
12
ااد م
ن ذب
:"6 S-
>> 2/3^2
ans =
0.2222
>> (2/3) ^2
ans =
0.4444
>> 2+3*4-4
ans =
10
>> 2^2*3/4
ans =
3
>> 2^(2*3)/(3+4)
ans =
9.1429
13
ااد م
ن ذب
(
"- &$ #$ ( # = "-
#$ @=" "
$ R$>clear
(
@
=
0 "- &$ /clc
!- !
#$ "
7 , (>who
$
'" (
) (
!- !
#$ "
7 , (>whos
()
current directory !- 0 0pwd
!- #$ A
'" ,what
0ans
3.1416 1
# 1 0) &) pi
(5inf
inf/inf
0/0 *@ !6 .- ( I B"
0) < &)nan
clear5 !6
14
ااد م
ن ذب
:
clear x
J? A A ?C
(x3) +' 0x) 3) !6 (= 5
(x,y,z) !6 7 )
.$
' !- 0 #$ /" ' )
* @
15
ااد م
ن ذب
STAR
#$ = ! #$ @= A A' J? .> !
" @= A
&
> *
FIEL
16
ااد م
ن ذب
EDIT
Debug
Stop If Errors/Warnings…
Stop If Errors/Warnings…
,? 8
) * / #$ 5 2?- &$
(
17
ااد م
ن ذب
Desktop:
Desktop:
!6 (!- 0 +? 0 '
% -?) (@'>
&$ (>
% 6$ * (
:
::
0-4
#$ $
0
1- Docked: ( 0 2" " P &$ 0
8..
2- Undocked: %4 (= !-
2" " &$ 0
8
18
ااد م
ن ذب
@ Window:
.6 P
Command
Command Window
&$ !6 $
2
'" '" 0 != 2 8
Help
\
- C ! !@
* #$
4 ) $
@= 2"
= 8
<"
7" "- 2
6
19
ااد م
ن ذب
20
ااد م
ن ذب
&$ ! " &$
(
< &= I
=
Workspace &$ .> >
!6 !' #$
&$
21
ااد م
ن ذب
'# !6 #$ *@ !- &$ JPN 3 .> 5 * 7 S
22
ااد م
ن ذب
= *
(
&$ #$ ans # (-4
&$ &
)
!6 3 #
&
:V? ")
!6 1=2U3
% 6$ #$ ( U ) < V? ") ;
23
ااد م
ن ذب
)" 4
!6 180 =12*15
; )" % 6$ ( * ) < 4
24
ااد م
ن ذب
:= ")
!6 4 :
3 .") 12 % 6$ ( / ) < = ") ;
:I +4
")
Q'
#$ Shift + 6 .") ?74 ! 0 < .") !
0 ( ^ ) I < ;
!6 144=2^12 % 6$
25
ااد م
ن ذب
:#-
12 1
144 " #-
% 6$ sqrt,
sqrt, J? 0) 1 #-
# !6
,6 0
) +4
8 B
= 0
) +4
$
* 0 6 P
C++
C++
Qbasic * #$
-
.* 0 ,<
#$ B
= $- #$ +
!6 0
5 - A 6 ( % )
@ ) +4
0 0 5 0
) +4
* #'$
# !6
26
ااد م
ن ذب
27
ااد م
ن ذب
:$
-
* #$ % = $- 7 S-
28
ااد م
ن ذب
Trigonometric Functions6"6
29
ااد م
ن ذب
30
ااد م
ن ذب
! :- 6"6
( ,<
2" ! .") " : : # !6
'- 6"6 !
! =? I
31
ااد م
ن ذب
@< !
" ( - S-
32
ااد م
ن ذب
- @< !
Inverse Hyperbolic Functions
- @< !
" ( 0
= S-
33
ااد م
ن ذب
!
4
5- #$ (z
(z) 7 S
- ! 0
=
- @< !
.")
34
ااد م
ن ذب
Complex Numbers )
- ,<
Real number #== )^ ,<
#
&
7 ) ;
# 7 #$ 0
Imaginary Numbers, #"
Imaginary Numbers,
35
ااد م
ن ذب
+ ) +
(4- + == ) +
J? 0) 2
:0 0) +
(4-
"- 2" &C # !6
36
ااد م
ن ذب
37
ااد م
ن ذب
-? P
" Natural Logarithm
< -? P
" < log(x)
log(x)
0 0 -
) = "-
0 0 > .") &= B $ 0 0 0 +
B; < 1C) 1
0 N Ceil
Floor 7
38
ااد م
ن ذب
# !6
$
' Matrices
39
ااد م
ن ذب
:$
'
(
:Vectors (
>> x=[3,5,2,8,11]
x=
3 5 2 8 11
.
/ B
) +
0 Q4
"' ) 0 5% $ +4
0
:1
) B
.2
>> x=[3;5;2;8;11]
x=
3
5
2
8
11
v=
2 5 0 1 4 -1
>> length(v)
ans =
6
>> w=sum(v)
w=
11
:!6 #$ = 8 0 B
)
N A
=:Max .3
>> w=max(v)
w=
5
:!6 #$ = 8 0 B
) 7
N A
= :Min .4
>> w=min(v)
w=
-1
$
'
I #?- :Size .5
>> Matrix=[1,2,3,;4,5,6]
Matrix =
1 2 3
4 5 6
>> [Matrix]=size(Matrix)
Matrix =
2 3
>> r=[9 7 5 8 3]
r=
9 7 5 8 3
41
ااد م
ن ذب
>> s=sort(r)
s=
3 5 7 8 9
B$ 7
#$ 0 J' A
= :Range .7
>> range(r)
ans =
6
I .> +$
4
V?
+
") "- A !C
:(
.") K
> # "-
.$
'
. (-
+ "- A 0 &C
0
:Q4
" "6 S-
>> x=[1,3,5];
>> y=[2,4,6];
>> z=x+y
z=
3 7 11
>> m=y-x
m=
1 1 1
>> p=x.*y
p=
2 12 30
>> p=x.^2
p=
1 9 25
:Matrices $
'
42
ااد م
ن ذب
# !C ;
&)
/
' &
#$ (-4
#
0 )
#
43
ااد م
ن ذب
/
' 0 0
$
'
% A 0
&)
B- 0- 0) &) # $
' 0
.&) )
n
/
' )
m 0 8 (mxn) 0 !
= &)
&)
>> Matrix=[1,2,3,;4,5,6;7,8,9]
Matrix =
1 2 3
4 5 6
7 8 9
.$
' 0 86
#6 /
> +? ;$ $
' 0 > 2
44
ااد م
ن ذب
>> Matrix(2,:)
ans =
4 5 6
.$
' 0 86
#6
-
> +? 2
>> Matrix(:,2)
ans =
2
5
8
&) $
' ) +
>
>> Matrix(:)
ans =
1
4
7
2
5
8
3
6
9
:#6
-
!
/ #$ +
- >
>> Matrix(1,2)
ans =
2
:$
' 0
)
/ /
>> Matrix(:,2) = [ ]
Matrix =
1 3
4 6
7 9
>> Matrix(2,:) = [ ]
Matrix =
1 2 3
7 8 9
:$
'"
)
/ /4
>> Matrix=[1,2,3,;4,5,6;7,8,9;10,11,12]
Matrix =
1 2 3
4 5 6
7 8 9
45
ااد م
ن ذب
10 11 12
:$
' ?
>> diag(Matrix)
ans =
1
5
9
:(Transpose) $
' !
=
0 (") ! # m × n
0 $
' B; A $
'" !
= /- n × m
0 $
' A = [aij ] 0
. A T < A !
=" < #
.") A /
' # ()
A &) # ($
' 0
8 A
>> A=[1 3 5; 2 4 6]
A=
1 3 5
2 4 6
>> A'
ans =
1 2
3 4
5 6
% @= det(A ) < B <
$
' /- n
0 - $
' A = [aij ] 0 :
:#
det(A ) = a11 ⇐ n = 1 0 > .1
det(A ) = a11a22 − a12a21 ⇐ n = 2 0 > .2
n
det(A ) = ∑ (−1) j +1 a1 j det A1 j ⇐ n > 2 0 > .3
j =1
: Q4
!6
>> A=[1 0 3 ; 4 5 0; 7 8 9]
A=
1 0 3
4 5 0
7 8 9
>> det(A)
46
ااد م
ن ذب
ans =
36
.$
'" #-
# $
' A -
' 0) &) ) ! 0
# #
:' $
' .1
>> x=zeros(3,2)
x=
0 0
0 0
0 0
.
0 ) +
0
# $
' #
:Q
) +
# $
' .2
>> x=ones(3,2)
x=
1 1
1 1
1 1
id =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
47
ااد م
ن ذب
x=
1 2 3
4 5 6
7 8 9
>> A=sum(x)
A=
12 15 18
>> A=sum(x')
A=
6 15 24
:!6 #$ $
' &) 0
) ! #$
S-
= #
:Max .2
>> B=max(x)
B=
7 8 9
>> B=max(x')
B=
3 6 9
: !6 #$ $
' - S- A
= :Size .3
>> [C,D]=size(x)
C=
48
ااد م
ن ذب
3
D=
3
:$
' .") "- ,
>
$
' ) 0 B - + .
$
' ) 0 ) ! +
+
") :+
.1
:!6 #$ 6
>> A=[1,3;5,7];
>> B=[2,4;6,8];
>> C=A+B
C=
3 7
11 15
>> C=A+3
C=
4 6
8 10
C=
-1 -1
-1 -1
:!6 #$ S- $
' ) 4 4 ") :4 .3
>> C=A*B
C=
20 28
52 76
:!6 #$ &
I .> - $
' +$ :(I)&
.> $
' +$ .4
>> C=A^2
C=
16 24
40 64
49
ااد م
ن ذب
>> C=A.^2
=C
1 9
25 49
50
ااد م
ن ذب
!
""6
: (1)"!ل#
؟ 2
y 1 = x cos x , y 2 = x sin x , x = −2 : 0.1: 2 2
'(1+ ا2345 0.+!/+ ا-./+ا,+ار(' ا
:78+ا
>> x=-2:0.1:2;
>> y1=x.^2.*cos(x);y2=x.^2.*sin(x);
>> plot(x,y1);
>> hold on
>> plot(x,y2);
>> hold off
>> xlabel('x-axis')
>> ylabel('y-axis')
>> grid on
:9+!/+(' ا1+! ا4+ 1:;ی
4
1
y axis
-1
-2
-3
y1
y2
-4
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
x axis
: (2)"!ل#
؟x=-4:0.1:4 , y=x^2 0+ا,+ار(' ا
:78+ا
>> x=-4:.1:4;
>> y=x.^2;
>> plot(x,y,'o')
16
:9+!/+(' ا1+! ا4+ 1:;ی
14
12
10
8
Y
0
-4 -3 -2 -1 0 1 2 3 4
X
51
ااد م
ن ذب
y=x.^2 0+ا,+ر(' ا
: (3)"!ل#
2 2
؟z = 2xy /(x + y ), for ,x = 1: 0.1: 3, and ,y = 1: 0.1: 3 0+ا,+ار(' ا
:78+ا
>> [x,y]=meshgrid(1:0.1:3,1:0.1:3);
>> z=2*x*y/(x^2+y^2);
>> surf(x,y,z);
>> xlabel('x')
>> ylabel('y')
>> zlabel('z')
1
z
-1
-2
3
2.5 3
2 2.5
2
1.5 1.5
y 1 1
x
>>contour(x,y,z)
>> xlabel('x')
>> ylabel('y')
52
ن ذب م
figure 3.1 ااد
3
2.8
2.6
2.4
2.2
y
1.8
1.6
1.4
1.2
1
1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3
x
:(4)"!ل#
('؟1+ ا23 ﻥ9J !@:GE5 H# -./+ا,+ح وا1>+ ا7B!@! وﺡ:E@F 7B! وﺡcosn(x),sin(x ) 0+ا,+ ا9@(ار
:78+ا
x=-10:.01:10;
y1=sin(x);
subplot(3,2,1)
plot(x,y1);xlabel('x');ylabel('y');title('sin(x)')
subplot(3,2,2)
y2=cos(x);
plot(x,y2,'r');xlabel('x');ylabel('y');title('cos(x)')
subplot(3,2,3)
plot(x,y1+y2,'k');xlabel('x');ylabel('y');title('sin(x)+cos(x)')
y4=y2-y1;
subplot(3,2,4)
plot(x,y1,x,y4);xlabel('x');ylabel('y');title('cos(x)-sin(x)')
y5=sin(x);
y6=cos(x);
subplot(3,2,5)
53
ااد م
ن ذب
plot(x,y5,'r',x,y6,'k');xlabel('x');ylabel('y');title('sin(x) and cos(x)')
sin(x) cos(x)
1 1
0 0
y
-1 -1
-10 -5 0 5 10 -10 -5 0 5 10
x x
sin(x)+cos(x) cos(x)-sin(x)
2 2
0 0
y
-2 -2
-10 -5 0 5 10 -10 -5 0 5 10
x x
sin(x) and cos(x)
1
0
y
-1
-10 -5 0 5 10
x
:(5) "!ل#
sin(R )
؟Z = وR = x 2 + y 2 0+ا,+ ا9@(ار
R
:78+ا
>> [X,Y] = meshgrid(-8:.5:8);
>> R = sqrt(X.^2 + Y.^2);
>> Z = sin(R)./R;
>> surf(X,Y,Z)
0.5
Z
-0.5
10
5 10
0 5
0
-5 -5
y -10 -10
x
54
ااد م
ن ذب
$
'
:(6) "!ل#
c=repmat(5,4,6)
c=
5 5 5 5 5 5
5 5 5 5 5 5
5 5 5 5 5 5
5 5 5 5 5 5
A=[1 2 3 4 5]
Sum(a)
sum(a)
ans =
15
d=
2 4 8 10 12
e=
1 3 7 11 13
>> f=d-e
f=
1 1 1 -1 -1
55
ااد م
ن ذب
y=1:0.1:10;
>> plot(y);
>> x=0:0.1:10;
>> y=san(x);
>> y=sin(x);
>> plot(x,y);
>> x=0:0.1:10;
>> y=sin(x);
>> z=cos(x);
>> w=[y;z];
>> plot[y;w];
plot(x,w);
:(9) "!ل#
fplot('sin(x)',[-pi,pi])
>> fplot('sin(x^2)',[-pi,pi])
56
ااد م
ن ذب
mesh
:(10) "!ل#
>> mesh(peaks);
>> [x y z ]= peaks(100);
>> figure;
>> mesh(x,y,z);
[x y z]=peaks(40);
meshc(x,y,z);
SURF
:(11) "!ل#
x,y,z]=peaks(30);
>> surf(x,y,z);
>> xlabel('x-axis','fontsize',11);
>> xlabel('y-axis','fontsize',11);
>> xlabel('z-axis','fontsize',11);
title('ISSAM SERHAN DYAB');
57
ااد م
ن ذب
:(12) "!ل#
x=linspace(0,10,100);
>> y=cos(x);
>> [x y]=meshgrid(x,y);
>> z=sin(x).*exp(-0.3.*x)./(cos(y)+2);
>> mesh(x,y,z);
:(13) "!ل#
>> x=linspace(0,10,1000);
>> y=cos(x);
>> [x y]=meshgrid(x,y);
>> z=sin(x).*exp(-0.3.*x)./(cos(y)+2);
>> mesh(x,y,z);
58
ااد م
ن ذب
Fplot
:(14) "!ل#
fplot('sin(x)',[-pi,pi])
>> fplot('sin(x^2)',[-pi,pi])
:(15) "!ل#
fplot('sin(x)*cos(x)',[-pi,pi])
>> grid on
>> help grid
GRID Grid lines.
GRID ON adds major grid lines to the current axes.
GRID OFF removes major and minor grid lines from the current axes.
GRID MINOR toggles the minor grid lines of the current axes.
GRID, by itself, toggles the major grid lines of the current axes.
GRID(AX,...) uses axes AX instead of the current axes.
59
ااد م
ن ذب
See also title, xlabel, ylabel, zlabel, axes, plot, box.
:(16) "!ل#
clc
>> x=[1 2 3 4 5 6 7 8 9 10]
x=
1 2 3 4 5 6 7 8 9 10
y=[2:2:120]
y=
Columns 1 through 14
2 4 6 8 10 12 14 16 18 20 22 24 26 28
Columns 15 through 28
30 32 34 36 38 40 42 44 46 48 50 52 54 56
Columns 29 through 42
58 60 62 64 66 68 70 72 74 76 78 80 82 84
Columns 43 through 56
86 88 90 92 94 96 98 100 102 104 106 108 110 112
Columns 57 through 60
114 116 118 120
length(y)
ans =
60
Plot(y)
60
ااد م
ن ذب
رهefg وhوijkا
:(17) "!ل#
title('dyaila university')
xlabel('ISSAM SERHAN')
>> ylabel('sin(x)cos(x)')
>>
61
ااد م
ن ذب
62
ااد م
ن ذب
(1) hlm
x = linspace ( 0, 10*pi, 100 );
y = exp ( -0.1 * x ) .* sin ( x )
plot ( x, y )
hold on
plot ( x, exp ( -0.1 * x ) )
plot ( x, -exp ( -0.1 * x ) )
hold off
63
ااد م
ن ذب
(2) hlm
x = 2 * pi * rand ( 10, 1 );
x = sort ( x );
y = sin ( x );
64
ااد م
ن ذب
(3 )hlm
x = linspace ( -2, 2, 10 );
y = x.^3 - x.^2 - 2*x;
xx = x;
yy = y .* ( 1.0 + 0.5 * randn ( 1, 10 ) );
plot ( x, y, 'b*-', xx, yy, 'ro-' )
65
ااد م
ن ذب
(4) hlm
x = 0 : 0.1 : 2;
taylor = x - x.^3 / 6;
error = taylor - sin ( x );
errorbar ( x, taylor, error )
66
ااد م
ن ذب
(5) hlm
X = F(T)
Y = G(T)
-------------------------------:
t = 0 : 0.1 : 2*pi;
x = t .* sin ( 3 * t );
y = t .* sin ( t ) .* sin ( t );
plot ( x, y )
67
ااد م
ن ذب
(6) hlm
68
ااد م
ن ذب
(7) hlm
69
ااد م
ن ذب
(8) hlm
y = rand ( 1000, 1 );
y = fix ( 20 * y );
hist ( y, 20 )
y = randn ( 1000, 1 );
hist ( y, 20 )
70
ااد م
ن ذب
(9) hlm
71
ااد م
ن ذب
(10) hlm
axis ( [ 0, 1, 0, 1 ] )
hold on
72
ااد م
ن ذب
(11) hlm
x = randn ( 20, 1 );
y = randn ( 20, 1 );
scatter ( x, y )
73
ااد م
ن ذب
(12) hlm
x = [ 1.0, 2.0, 2.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0, 0.0, 0.0, 1.0];
y = [ 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0];
fill ( x, y, 'r' )
74
ااد م
ن ذب
(13) hlm
x = randn ( 20, 1 );
y = randn ( 20, 1 );
scatter ( x, y )
hold on
k = convhull ( x, y );
plot ( x(k), y(k) )
75
ااد م
ن ذب
(14) hlm
x = randn ( 20, 1 );
y = randn ( 20, 1 );
tri = delaunay ( x, y );
[ ntri, ncol ] = size ( tri );
tri(:,4) = tri(:,1);
scatter ( x, y )
for i = 1 : ntri
line ( x(tri(i,:)), y(tri(i,:)) )
end
76
ااد م
ن ذب
(15) hlm
x = randn ( 20, 1 );
y = randn ( 20, 1 );
voronoi ( x, y )
77
ااد م
ن ذب
(16) hlm
78
ااد م
ن ذب
(17) hlm
x = 2 * rand ( 121, 1 );
y = 2 * rand ( 121, 1 );
u = cos(x) .* sin(y);
v = sin(x) .* y - log(x+1);
norm = sqrt ( u.*u + v.*v );
indx = find ( norm );
u(indx) = u(indx) ./ norm(indx);
v(indx) = v(indx) ./ norm(indx);
quiver ( x, y, u, v )
79
ااد م
ن ذب
(18) hlm
80
ااد م
ن ذب
(19) hlm
load ( 'nodes6.txt' );
load ( 'velocity6.txt' );
x = nodes6(:,1);
y = nodes6(:,2);
u = velocity6(:,1);
v = velocity6(:,2);
xtab = reshape ( x, 5, 13 );
ytab = reshape ( y, 5, 13 );
utab = reshape ( u, 5, 13 );
vtab = reshape ( v, 5, 13 );
xstart = [ 0, 0, 0, 0, 0, 0 ];
ystart = [ 0, 0.2, 0.4, 0.6, 0.8, 1.0];
axis equal
streamline ( xtab, ytab, utab, vtab, startx, starty );
hold on;
k = convhull ( x, y );
plot ( x(k), y(k), 'r' );
hold off
81
ااد م
ن ذب
(20) hlm
82
ااد م
ن ذب
(21) hlm
83
ااد م
ن ذب
(22) hlm
nframes = 51;
for i = 1 : nframes
t = 2 * ( i - 1 ) * pi / ( nframes - 1 );
y = 5.0 * cos ( 2.0 * x / 12.0 ) .* sin ( t ) .* cos ( t + x );
plot ( x, y )
axis equal
my_frames(:,i) = getframe;
end
movie ( my_frames, 2 )
84
ااد م
ن ذب
(23) hlm
85
ااد م
ن ذب
86
ااد م
ن ذب
87