Professional Documents
Culture Documents
MATLAB
MATLAB
Khadija ABID
10/02/2018
2 18/02/2020
Plan
كيفية التعامل مع MATLABألول مرة
كيفية حل المعادالت
برنامج السيميولينك
3 18/02/2020
Questions
4 18/02/2020
ما هو ماتالب؟
Matrix Laboratory
برنامج ولغة لتطبيق العمليات
الرياضية للحسابات العلمية
والهندسية
مصمم لعمليات المصفوفات
صمم في بداية السبيعنات
و مبني على مكتبات
LINPACK FORTRAN
أيضاً مشهور بقدراته الخاصة
بالرسومات واألدوات المختلفة
التطبيقات
5 18/02/2020
ما هو ماتالب؟
برنامج
هندسي
Mechanical field
Electronics
Automotive Industry
Aerospace & Defense
Integration
MATLAB Differentiation
Algebric Equation
Partial fraction
التطبيقية األكاديمية
6 18/02/2020
ما هو ماتالب؟
OUTPUT OUTPUT
INPUT
INPUT
COMMANDS
7 18/02/2020
Matlab نافذة
Matlab ذاكرة
Command
History
( الجديدةMatlab
)اصدارات
نافذة األوامرCommand
Window
8 18/02/2020
Matlab أجزاء
Operators العمليات
Matrices المصفوفات
Plotting الرسومات
M-files الملفات
Flow control التحكم بالتنفيذ
Simulink Simulink
Misc commands أوامر أخرى
9 18/02/2020
لنفترض أننا قمنا بتغيير الناتج 5إلى ,3قم بإغالق نافذة تعديل النتائج
بعض األمثلة
هنا نطلب من المستخدم ادخال الدالة
;)'reply = input('Entez un fonction: ','s
و هنا نحول المتغير السابق الذي هو عبارة عن نص الى دالة يفهمها الماتالب
;)f = inline(reply
هنا معرف اسم المتغير الذي سوف نشتق ألجله الدالة
symsو اجراء
ادخال; xدالة
عملية االشتقاق؟ و هنا عملية اإلشتقاق
;)chain_f=diff(char(f), x
و هنا طباعة اسم الدالة المشتقة على الشاشة
;)disp (chain_f
13 18/02/2020
بعض األمثلة
هو تقريبا نفس الكود السابق فنحن نطلب من المستخدم
ادخال الدالة ثم ادخال حد التكامل األول ثم الثاني ثم نقوم
بحساب قيمة التكامل للدالة على هذا المجال
;)'reply = input('Entez un fonction: ','s
;)f = inline(reply
;)' a = input('Entez la 1 er borne de lintegrale:
b = input('Entez la 2 emme borne
لدالة de lintegrale:
التكامل قيمة ;)'
;syms x
هنا نحسب التكامل على المجال المعني
;)chain_f=int(char(f),x, a, b
;)disp (chain_f
14 18/02/2020
متغيرات Matlab
قيمة تخزن جميع متغيرات كأرقام حقيقية وبحجم 8بايت لكل
ال فرق بين األرقام الصحيحة والحقيقية :
;>> p = 3
;>> p = 3.0 نفس األمر!
كقيم : يمكن تخزين أرقام أو حروف
;>>number_123=7
;'>>text04='This is GE204
والصغيرة : يوجد فرق بين الحروف الكبيرة
;>> a = 4
;>> A = 10 Aa
الذاكرة : يمكن مسح المتغير من
>> clear a
15 18/02/2020
Matlab Help
• اكتب
>>help
لمعرفة
المزيد عن
أوامر ودوال
Matlab
17 18/02/2020
Matlab Help
square root
function help
18 18/02/2020
19 18/02/2020
المصفوفات
]>> A=[6 5; 3 4
=A
6 5 تبرز قوة Matlabعند
استخدام المصفوفات
3 4
Arraysالمصفوفات
??
20 18/02/2020
المصفوفات
]>> A=[6 5; 3 4
كل مصفوفة تتكون من عناصر
=A
عناصر المصفوفة تكون الصفوف
6 5 واألعمدة
3 4 يمكن التعامل مع عناصر
>> A(1,1)=10 المصفوفة باستخدام رقم الصف
Arraysالمصفوفات
والعمود
أمثلة ؟
=A
10 5 يمكن توليد متجه (مصفوفة ذات
3 4 بعد واحد) باستخدام األمر
التالي:
>> 1:2:7
initial:step:final
=ans
النهاية:الخطوة:البداية
1 3 5 7
(اذا لم يتم تحديد الخطوة،
>> 1:4 سيفرض أنها )1
=ans
1 2 3 4
21 18/02/2020
عمليات المصفوفات
* الضرب
*. ضرب العناصر
/ القسمة
./ قسمة العناصر
Arraysالمصفوفات
^ األس
^. األس للعناصر
))('(or transpose التبديل
))(^-1 (or inv المعكوس
)(length طول المصفوفة
)(size أبعاد المصفوفة
22 18/02/2020
عمليات المصفوفات
أمر Matlab العملية الرياضية
1
;>> C=B/A C BA
24 18/02/2020
تبديل المصفوفة
العملية الرياضية
Matlab أمر
C=AT
>>C=A’;
1 2 3
المصفوفاتArrays
A
4 5 6
>>B=A’;
1 4
B 2 5
3 6
25 18/02/2020
تضمين المصفوفات
1 2 3 2 3 4
A B
4 5 6 5 6 7
المصفوفاتArrays
1 2 3 2 3 4
D
4 5 6 5 6 7
26 18/02/2020
تطبيق
Créez un tableau tab contenant les entiers pairs
de 0 à 42,
écrivez un script qui parcourt le tableau et
remplace chacune des valeurs par son carré.
المصفوفاتArrays
>>tab = 0:2:42;
puis dans un script :
for i = 1:size(tab,2)
tab(i) = tab(i).^2;
end
27 18/02/2020
تطبيق
Définissez une matrice M = [1 2 ; 3 4] puis
essayez les opérations suivantes dans
l’interpréteur:
>> 2 * M + 3
المصفوفاتArrays
>> M + M
>> sqrt(M)
>> M * M
>> M .* M
>> ones(4)
>> ones(3, 5)
28 18/02/2020
أمر plot
;>> n=0:11 !… , y1, x1ال بد من تساوي أبعاد
>>
;)y=sin((pi/6)*n
Plottingالرسومات
)>> plot(n,y
)'>> plot(n,y,'--
رسم باستخدام
خط متقطع
33 18/02/2020
أمر plot
كيفية رسم دالة معينة؟
االمر PLOTلرسم مصفوفة يكون
أمر subplot
رقم الرسمة
)subplot(m,n,p
عدد الصفوف عدد األعمدة
Plottingالرسومات
35 18/02/2020
دوال الرسومات
title لكتابة اسم الرسمة
xlabel لكتابة اسم محور س
ylabel لكتابة اسم محور ص
grid لعرض شبكة بالرسم
Plottingالرسومات
التحكم بالتنفيذ
;a=2
;b=3
;c=a+b
عادة ،يكون تنفيذ األوامر بالتسلسل
;)d=sqrt(b
Flow controlالتحكم بالتنفيذ
أوامر تكرار
38 18/02/2020
حساب الشرط
أية معادلة
المعامالت الشرطية
حسابية ==يساوي
;a=4
;b=5 <أقل من
;c=5 >أكبر من
Flow controlالتحكم بالتنفيذ
)if/if-else( أمثلة
>> a=6; >> a=50;
>> if a<10 >> if a<10
b=a/2; b=a/2;
التحكم بالتنفيذFlow control
end end
>> b >> b
b = 3 ??? Undefined function or variable 'b'.
)while( أمثلة
>> a=1;
>> a=1;
>> while a<5
>> while a<5
a=a+1
b=a+1
end أمر end
التحكم بالتنفيذFlow control
a = 2
a = 3 !تكرار b = 2
b = 3
a = 4
b = 4
a = 5
b = 5
>> a=10; b = 6
>> while a<5 b = 7
a=a+1 .
end .
>> a .
.
loop!
a = 10
42 18/02/2020
أمر for
for index = start : [increment :] end
أمر
statements
تكرار! end
Flow controlالتحكم بالتنفيذ
المعادالت الرمزية
sym/syms لتعريف متغيرات رمزية (sym
يحتوي على خيارات اكثر)
diff تفاضل
Misc. commandsأوامر أخرى
أوامر إضافية
clc مسح الشاشة
clf مسح الرسومات
format التحكم بعرض األرقام
Misc. commandsأوامر أخرى
ما هو Simulink؟
Simulinkهو برنامج للنمذجة و المحاكاة و تحليل االنظمة
ما هو Simulink؟
ويعتبر ال SIMULINKاداة ممتازة لى Model-Based
Designوهذا معناه ان البرنامج ليس فقط قاصرا على
االنظمة المثالية ولكن يمكنك ايضا من نمذجة انظمة
حقيقة والتى يوجد بها عوامل موثرة لجعلها غير خطية
nonlinearمثل االحتكاك ومقامة الهواء وانزالق
التروس والظواهر الطبيعية االخرى .
48 18/02/2020
أمثلة
49 18/02/2020
أمثلة
50 18/02/2020
أمثلة
51 18/02/2020
أمثلة
52 18/02/2020
أمثلة
53 18/02/2020
أمثلة
54 18/02/2020
أمثلة
55 18/02/2020
56 18/02/2020
histeq
J = histeq(I,hgram)
J = histeq(I,n)
[J,T] = histeq(I)
newmap = histeq(X,map)
newmap = histeq(X,map,hgram)
[newmap,T] = histeq(X,___)
histeq
[J,T] = histeq(I) returns the grayscale transformation T that
maps gray levels in the image I to gray levels in J.
newmap = histeq(X,map) transforms the values in the
colormap so that the histogram of the gray component of
the indexed image X is approximately flat. It returns the
transformed colormap in newmap.
This syntax is not supported on a GPU.
newmap = histeq(X,map,hgram) transforms the colormap
associated with the indexed image X so that the histogram
of the gray component of the indexed image (X,newmap)
approximately matches the target histogram hgram. The
histeq function returns the transformed colormap in
newmap. length(hgram) must be the same as size(map,1).
This syntax is not supported on a GPU.
[newmap,T] = histeq(X,___) returns the grayscale
transformation T that maps the gray component of map to
the gray component of newmap.
This syntax is not supported on a GPU.
71 18/02/2020
histeq
I = imread('tire.tif');
Enhance the contrast of an intensity image using
histogram equalization.
J = histeq(I);
Display the original image and the adjusted
image.
imshowpair(I,J,'montage') axis off
72 18/02/2020
imadjust
J = imadjust(I)
J = imadjust(I,[low_in high_in])
J = imadjust(I,[low_in high_in],[low_out high_out])
J = imadjust(I,[low_in high_in],[low_out
high_out],gamma)
J = imadjust(RGB,[low_in high_in],___)
newmap = imadjust(cmap,[low_in high_in],___)
73 18/02/2020
imadjust
I = imread('pout.tif');
imshow(I)
Adjust the contrast of the image so that 1% of the
data is saturated at low and high intensities, and
display it.
J = imadjust(I); figure imshow(J)
74 18/02/2020