tipe plot

Post on 02-Oct-2015

217 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

-

TRANSCRIPT

a) Tipe Plot>> x=linspace(0,2*pi,30);>> y=sin(x);>> plot(x,y)

b) Tipe Plotx=0:0.5:20;>> y=2*x.^2+5*x+2;>> z=sqrt(4*x+2);>> >> subplot(2,1,1)>> plot(x,y,'r')>> grid on;>> xlabel('Nilai x'),ylabel('Nilai y')>> legend('x thd y')>> subplot(2,1,2)>> plot(x,z,'b')>> grid on;>> xlabel('Nilai x'),ylabel('Nilai z')>> legend('x thd z')

c) Tipe stem>> x=0:0.5:20;>> y=2*x.^2+5*x+2;>> z=sqrt(4*x+2);>> >> subplot(2,1,1)>> stem(x,y,'r')>> grid on;>> xlabel('Nilai x'),ylabel('Nilai y')>> legend('x thd y')

>> subplot(2,1,2)>> stem(x,z,'b')>> grid on;>> xlabel('Nilai x'),ylabel('Nilai z')>> legend('x thd z')

d) Tipe Stemx=0:0.5:20;>> y=2*x.^2+5*x+2;>> z=sqrt(4*x+2);>> >> subplot(2,1,1)>> bar(x,y,'g')>> grid on;>> xlabel('Nilai x'),ylabel('Nilai z')>> legend('x thd y')>> >> subplot(2,1,2)>> bar(x,z,'m')>> grid on;>> xlabel('Nilai x'),ylabel('Nilai z')>> legend('x thd z')

e) Tipe Stairsx=0:0.5:20;>> y=2*x.^2+5*x+2;>> z=sqrt(4*x+2);>> >> subplot(2,1,1)>> stairs(x,y,'r')>> grid on;>> xlabel('Nilai x'),ylabel('Nilai y')>> legend('x thd y')>> subplot(2,1,2)>> stairs(x,z,'b')>> grid on;>> xlabel('Nilai x'),ylabel('Nilai z')>> legend('x thd z')

f) Tugas 1>> x=linspace(0,2*pi,20);>> y1=sin(x);>> y2=cos(x);>> plot(x,y1,'r')>> hold on>> plot(x,y2,'y')

g) Tugas 2>> z=[ 20 6 14 95; 18 3 28 11; 1 5 27 6; 21 10 22 12]

z =

20 6 14 95 18 3 28 11 1 5 27 6 21 10 22 12b=z'

b =

20 18 1 21 6 3 5 10 14 28 27 22 95 11 6 12mean(z)

ans =

18.6875>> max(z)

ans =

95

>> min(z)

ans =

1

h) >> bar(T)>> T=[10 20 30 40, 5 15 25 35, 7 14 7 20];bar(T)grid on;

i)

top related