Lab1
-
Upload
beer-srisudaporn -
Category
Business
-
view
25 -
download
0
Transcript of Lab1
24 มีนาคม 2559 (Week 1)
1.การพลอ็ตกราฟ 1 เส้น
การพลอ็ตกราฟ
ใช้คาํส่ัง
x = [4 7 16];
y = [1 2 3];
plot (x,y)
กด Enter
ผลจะปรากฏตามรูป
การตั้งช่ือกราฟ
ใช้คาํส่ัง
x = [4 7 16];
y = [1 2 3];
plot (x,y)
title(‘score of crassroom’)
กด Enter
ผลจะปรากฏตามรูป
ตั้งช่ือแกน X และแกน Y
ใช้คาํส่ัง
x = [4 7 16];
y = [1 2 3];
plot (x,y)
title(‘score of crassroom’)
xlable(‘crassroom’)
ylable(‘score’)
กด Enter
ผลจะปรากฏตามรูป
ลกัษณะเส้นกราฟ
เปล่ียนเส้นกราฟเป็นสีแดง
สีทีใ่ช้ในการเปลีย่นเส้น มี สีแดง (Red), สีเขียว (Green), สีเหลือง (Yellow), สีนํ้าเงิน (Blue), สีดาํ (K)
ใช้คาํส่ัง
x = [4 7 16];
y = [1 2 3];
plot (x,y)
title(‘score of crassroom’)
xlable(‘crassroom’)
ylable(‘score’)
plot(x,y,’red’)
กด Enter
ผลจะปรากฏตามรูป
เปล่ียนเส้นกราฟเป็นเส้นปะ
การทํากราฟให้เป็นเส้นปะ ใช้ (- -)
ใช้คาํส่ัง
x = [4 7 16];
y = [1 2 3];
plot (x,y)
title(‘score of crassroom’)
xlable(‘crassroom’)
ylable(‘score’)
plot(x,y,’red’)
plot(x,y,’—r’)
กด Enter
ผลจะปรากฏตามรูป
เปล่ียนเส้นกราฟเป็นเส้นปะสลบักบัจุด
ใช้คาํส่ัง
x = [4 7 16];
y = [1 2 3];
plot (x,y)
title(‘score of crassroom’)
xlable(‘crassroom’)
ylable(‘score’)
plot(x,y,’red’)
plot(x,y,’--r’)
plot(x,y,’-.r’)
กด Enter
ผลจะปรากฏตามรูป
เปล่ียนเส้นกราฟเป็นเส้นปะสลบัเคร่ืองหมายบวก
ใช้คาํส่ัง
x = [4 7 16];
y = [1 2 3];
plot (x,y)
title(‘score of crassroom’)
xlable(‘crassroom’)
ylable(‘score’)
plot(x,y,’red’)
plot(x,y,’--r’)
plot(x,y,’-.r’)
plot(x,y,’-+r’)
กด Enter
ผลจะปรากฏตามรูป
เปล่ียนเส้นกราฟเป็นเส้นปะสลบัวงกลม
ใช้คาํส่ัง
x = [4 7 16];
y = [1 2 3];
plot (x,y)
title(‘score of crassroom’)
xlable(‘crassroom’)
ylable(‘score’)
plot(x,y,’red’)
plot(x,y,’--r’)
plot(x,y,’-.r’)
plot(x,y,’-+r’)
plot(x,y,’-or’)
กด Enter
ผลจะปรากฏตามรูป
2) การพลอ็ตกราฟ 3 เส้น
พลอ็ตกราฟ 3 เส้น
ใช้คาํส่ัง
x = [2 5 9 10 21];
y = [3 9 5 11 13];
z = [4 6 9 3 21];
t = [3 4 5 6 7];
plot(x,t,’—r’,y,t,’-.b’,z,t,’-^k’)
กด Enter
ผลจะปรากฏตามรูป
ใส่สญัลกัษณ์และความหมายสัญลกัษณ์ (แต่สญัลกัษณ์ยงับงัขอ้มูลอยู)่
สัญลกัษณ์ (Legend) ไดแ้ก่ เคร่ืองบิน = สีแดง (r), รถไฟ = สีนํ้ าเงิน (b), เรือ = สีดาํ (k)
ใช้คาํส่ัง
x = [2 5 9 10 21];
y = [3 9 5 11 13];
z = [4 6 9 3 21];
t = [3 4 5 6 7];
plot(x,t,’—r’,y,t,’-.b’,z,t,’-^k’)
legend(‘airplane’,’train’,’ship’)
กด Enter
ผลจะปรากฏตามรูป
กราฟของเคร่ืองบิน
เคร่ืองบิน = สีแดง (r)
ใช้คาํส่ัง
x = [2 5 9 10 21];
y = [3 9 5 11 13];
z = [4 6 9 3 21];
t = [3 4 5 6 7];
plot(x,t,’--r’,y,t,’-.b’,z,t,’-^k’)
legend(‘airplane’,’train’,’ship’)
legend(‘location’,’northwest’)
subplot(2,2,1)
plot(x,t,’--r’)
กด Enter
ผลจะปรากฏตามรูป
กราฟของรถไฟ
รถไฟ = สีนํา้เงิน (b)
ใช้คาํส่ัง
x = [2 5 9 10 21];
y = [3 9 5 11 13];
z = [4 6 9 3 21];
t = [3 4 5 6 7];
plot(x,t,’--r’,y,t,’-.b’,z,t,’-^k’)
legend(‘airplane’,’train’,’ship’)
legend(‘location’,’northwest’)
subplot(2,2,1)
plot(x,t,’--r’)
subplot(2,2,2)
plot(y,t,’-^k’)
กด Enter
ผลจะปรากฏตามรูป
กราฟเรือ
เรือ = สีดํา (k)
ใช้คาํส่ัง
x = [2 5 9 10 21];
y = [3 9 5 11 13];
z = [4 6 9 3 21];
t = [3 4 5 6 7];
plot(x,t,’--r’,y,t,’-.b’,z,t,’-^k’)
legend(‘airplane’,’train’,’ship’)
legend(‘location’,’northwest’)
subplot(2,2,1)
plot(x,t,’--r’)
subplot(2,2,2)
plot(y,t,’-^k’)
subplot(2,2,3)
plot(z,t,’-.b’)
กด Enter
ผลจะปรากฏตามรูป