Professional Documents
Culture Documents
Introduction
)MATLAB(MATrix LABoratory
مختبـــر المصفوفه
يدخل الماتلب في الوقت الراهن في الكثير من الفروع العلمية
:والتطبيقية منها
معالجة الشارة . signal processing 1-
الشبكات العصبية .neural netwoks 2-
معالجة الصور image processing 3-
2
5
1
4
3
• whos List variables in the workspace عدد مكوناتها خاصة للمصفوفات و,إظهار أسماء المتغيرات المسجلة في مجال العمل حجمها بالبايت
نوعها
• what The command WHAT, by itself, lists the MATLAB specific files found
in the current working directory.
إفراغ كافة البيانات المسجلة تلقائيا في والتعليمات السابقة التي تم كتابتها في نافذة clear all:
التعليمات
مثل Clear
إظهار الملفات المتواجدة في مسار العمل .ويمكن إستخدامها لختيار إظهار ملفات ذات إمتداد معين بالكيفية ls:
:التالية
ls *.m
كباقي لغات البرمجة ,يحتفظMatlab
بمجموعة من الكلمات التي يمنع إستعمالها في غير محلها كتسمية المتغيرات .عند كتابة إحدى هذه الكلمات
يصبح لونها أزرق
لضافة تعليقات لجعل الكود أكثر وضوحا ينبغي إستعمال رمز النسبة المئوية " "%في بداية كل سطر من
.أسطر التعليقات .هذا الحل مفيد أيضا عند الرغبة في إخراج جزء من الكود من عملية الترجمة
ويكفي أن تقوم بتظليل السطر المعنية ,ثم إختر عند النقر بيمين الفأرة Comment
a)Vector indexing:
V=[1 3 5 7 9]
W=V’
V(1:3)
V(3:end)
V(:) use of a single colon as an index into a matrix
selects the elements of the array(on a column-by-column
basis) and arranges them in the form of a column vector.
V(1:end)
V(1:2:end)
V(end:-2:1)
V([1 4 5]) pick the first, fourth, and fifth elements of V
A=[1 2 3; 4 5 6; 7 8 9]
sum(diag(A)).
A(2,3)
C=A(:,3)
R=A(2, :)
T=A(1:2, 1:3) extracts the top two rows
B=A;
B(:, 3)=0
A(end, end)
A(end, end-2)
A(2:end, end:-2:1)
E=A([1 3], [2 3]) -- the notation A([a b],[c d]) picks out the elements in A
with coordinates(row a, column c), (row a, column d) ; (row b, column c)
and (row b, column d).
V=T(:)use of a single colon as an index into a matrix selects the
elements of the array(on a column-by-column basis) and arranges them
in the form of a column vector.
S=sum(A(:))
sum(sum(A))
Note that: use of a single colon العظيم
converts
ايمان عبد/ مthe matrix into a vector.
Some Important Standard Arrays:
• Syntax:
var=imread(‘filename’)
• Example 1: (e1.m)
f=imread(‘city.jpg’);
>> imshow(f)
f=imread('flower.jpg')
imwrite(f,'city.jpg')
If f is an image
f=imread(‘flower.jpg’);
Fp=f(end:-1:1,:); flip image vertically
imshow(Fp)
Fc=f(50:90,50:90);
imshow(Fc) ما التأثير على الصورة ؟
Fs=f(1:2:end, 1:2:end);
imshow(Fs) ما التأثير على الصورة ؟