Professional Documents
Culture Documents
Matlab Lecture: Plotting Function
Matlab Lecture: Plotting Function
;X=0: pi/100:2*pi
;)Y=sin(x
)Plot (Y
االن نرسم الدالة التي تحتوي على المتغيريين معا نفس البرنامج فقط الخطوة االخيرة تصبح:
)Plot(x,y
1
Lec.Nura Jasim Muhammed Matlab Lectures
Lec. Jasim JarallahFahad Lec.6
Line style and colors تحديد نوع الخط وااللوان عند الرسم
: هناك انواع مختلفة من الخطوط وااللوان وحتى شكل النقاط المحددة للرسم كما موضح بالجدول التالي
2
Lec.Nura Jasim Muhammed Matlab Lectures
Lec. Jasim JarallahFahad Lec.6
Example:
;X1=0:pi/100:2*pi
;X2=0:pi/10:2*pi
Example:
;X1=0:pi/100:2*pi
;X2=0:pi/10:2*pi
)'Plot(x1,sin(x1), 'r:
Hold on
3
Lec.Nura Jasim Muhammed Matlab Lectures
Lec. Jasim JarallahFahad Lec.6
Example:
;t=0:pi/10:2*pi
;x=sin(t);y=cos(t);z=2*y-3*x;v=5-z
)subplot(2,2,1);plot(x
)subplot(2,2,2);plot(y
)subplot(2,2,3);plot(z
)subplot(2,2,4);plot(v
4
Lec.Nura Jasim Muhammed Matlab Lectures
Lec. Jasim JarallahFahad Lec.6
Xlable
Ylable
Zlable
Example:
;t=-pi:pi/100:pi
;)y=sin(t
)plot(t,y
)]axis([-pi pi -1 1
)'xlable('-\pi to \pi
)')ylable('sin(t
5
Lec.Nura Jasim Muhammed Matlab Lectures
Lec. Jasim JarallahFahad Lec.6
0.8
0.6
0.4
0.2
sin(t)
-0.2
Note the odd symmetry
-0.4
-0.6
-0.8
-1
-3 -2 -1 0 1 2 3
- to