0% found this document useful (0 votes)
32 views7 pages

Didit Retno C (Plotting)

This document contains the source code and output of several plotting programs written in MATLAB. It includes plots of simple functions like y=x, y=x^2, sine and cosine waves. It also demonstrates how to add titles, labels, grids and legends. The final plot shows two polynomial functions on the same graph to compare them.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views7 pages

Didit Retno C (Plotting)

This document contains the source code and output of several plotting programs written in MATLAB. It includes plots of simple functions like y=x, y=x^2, sine and cosine waves. It also demonstrates how to add titles, labels, grids and legends. The final plot shows two polynomial functions on the same graph to compare them.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Tugas Mata kuliah

Praktikum Dasar Komputer & Pemrograman


PLOTING

Nama : Didit Retno Cahyono


NIM : 2014415004

Program Studi Teknik Sipil


Fakultas Teknik

Universitas Dr. Soetomo


Surabaya
2014

Grafik X = Y
Source code
clear;
clc;
x = 0 : 5 : 50;
y = x;
plot(x , y)

Output

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

Output

Source code

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

Output

Program Menambahkan Judul Grid Line, Label dan Grafik

Source code
clear;
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 COS

Source code
clear;
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 PLOTING

Source code
clear;
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

You might also like