9
Tugas Mata kuliah Praktikum Dasar Komputer & Pemrograman “PLOTING” Nama : Didit Retno Cahyono NIM : 2014415004 Program Studi Teknik Sipil Fakultas Teknik Universitas Dr. Soetomo

Didit Retno c (Plotting)

Embed Size (px)

DESCRIPTION

mat lab

Citation preview

Tugas Mata kuliahPraktikum Dasar Komputer & PemrogramanPLOTING

Nama : Didit Retno CahyonoNIM : 2014415004Program Studi Teknik SipilFakultas TeknikUniversitas Dr. SoetomoSurabaya2014

Grafik X = YSource codeclear;clc; x = 0 : 5 : 50;y = x;plot(x , y)

Output

Source codeclear;clc; x = -50 : 5 : 50;y = x.^2;plot(x , y)

Output

Source codeclear;clc; x = 0 : 1 : 20;y = x.^2;plot(x , y)

Output

Program Menambahkan Judul Grid Line, Label dan GrafikSource codeclear;clc; x = -50 : 10 : 50;y = x.^2;plot(x , y),xlabel('x'),ylabel('y'),grid on,title('grafik y = x^2')

Output

Grafik SIN dan COSSource codeclear;clc; x = 0 : 0.02 : 20;y = sin(x);g = cos(x);plot(x , y , x , g),xlabel('x'),ylabel('y'),grid on,title('grafik sin dan cos')

Output

TUGAS PLOTINGSource codeclear;clc; x = -20 : 0.02 : 20;f = 3 * x.^4 + 2 * x.^3 + 7 * x.^2 + 2 * x + 9;g = 5 * x.^3 + 9 * x + 2;plot(x , f , 'b' , x , g , 'm'),legend('f' , 'g'),xlabel('x'),ylabel('y'), grid on,title('grafik f(x) dan g(x)')

Output