TU Wien:Statistik und Wahrscheinlichkeitstheorie UE (Bura)/Übungen 2019W/2.7

Aus VoWi
Zur Navigation springen Zur Suche springen
R-functions
(a) Using the R software, define a vector x that contains the values of the column Height from the dataset trees. Round the values of x to the tenth place and then output the number of each type. The commands round() and table() should be used.
Note that trees is the R Dataset Package containing Diameter, Height and Volume for 31 Black Cherry trees.
(b) Write a function in R that outputs the first n Fibonacci numbers. Calculate the sum of the first 10 and the first 20 Fibonacci numbers.
(c) Consider the curve given by the parametrization
Set the working directory by using R function setdw(). Use plot() to plot the curve and dev.print() to save the result as a pdf file.

Meine Lösungen[Bearbeiten | Quelltext bearbeiten]

t <- seq(0, pi*2, 0.01) x <- sin(2*t) y <- cos(3*t)


plot(x,y, type="l", lty=5, xlab = "sin(2*t)", ylab = "cos(3*t)") }