Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Komputer 2 SATS4223

Tugas 2
Untuk materi inisiasi:
• Materi 4 – Grafik dalam Pemrograman R
• Materi 5 – Pemeriksaan Data
• Materi 6 – Komputasi Aljabar Linear

Soal no 1:
Buatlah perintah R untuk membuat kurva dan histogram untuk distribusi normal baku (N(0,1)) dalam
satu bidang jendela untuk beberapa banyak bilangan acak sebagai berikut:
a. n=10
b. n=100
c. n=500
d. n=100
dengan hasil menyerupai sebagai berikut.

Soal no 2.
Diketahui suatu matriks A sebagai berikut
1 0 −3 −1

[
A= 4 8 0
3 0 6 0
9 5 7 −2
Tentukan:
0
]
a. teras (trace) dari matriks A
b. determinan matriks A , apakah matriks A merupakan matriks non singular?
c. kebalikan matriks A
d. nilai eigen dan vektor eigen matriks A
1. a. n=10
> set.seed(1)
> x<-rnorm(10)
> a<-seq(-3, 3, length=10)
> b<-dnorm(a)
> plot(a, b, type="l", ylim=c(0,0.5),main="Grafik n=10",xlab="x", ylab="Frekuensi Relatif")
> hist(x, prob=T, add=T, density=25, angle=30, col="darkblue")

b. n=100
> set.seed(1)

> x<-rnorm(100)

> a<-seq(-3, 3, length=100)


> b<-dnorm(a)

> plot(a, b, type="l", ylim=c(0,0.5),main="Grafik n=100",xlab="x", ylab="Frekuensi Relatif")

> hist(x, prob=T, add=T, density=25, angle=30, col="darkblue")

c. n=500
> set.seed(1)

> x<-rnorm(500)

> a<-seq(-3, 3, length=500)

> b<-dnorm(a)
> plot(a, b, type="l", ylim=c(0,0.5),main="Grafik n=500",xlab="x", ylab="Frekuensi Relatif")

> hist(x, prob=T, add=T, density=25, angle=30, col="darkblue")

c. grafik n=1000

> set.seed(1)

> x<-rnorm(1000)

> a<-seq(-3, 3, length=1000)

> b<-dnorm(a)

> plot(a, b, type="l", ylim=c(0,0.5),main="Grafik n=1000",xlab="x", ylab="Frekuensi Relatif")

> hist(x, prob=T, add=T, density=25, angle=30, col="darkblue")


2.

You might also like