A Brief Introduction To R
A Brief Introduction To R
Starting R
Download R from the above web site, and install it, press the icon for R on your desktop.
Data is a vector
For example, input 10 students marks
mark <- c(72,38,43,81,79,71,65,59,90,83)
Basic R commands
Statistical Commands
Graphics
Introduction to MATLAB
MATLAB (matrix laboratory) is a numerical computing environment and fourth-generation
programming language. Developed by MathWorks, MATLAB allows matrix manipulations,
plotting of functions and data, implementation of algorithms, creation of user interfaces, and
interfacing with programs written in other languages, including C, C++, Java, and Fortran.
Entering matrix
>> A = [1, 2, 3; 4, 5, 6; 7 8 9]
>> B = eye(3)
Matrix function and manipulation
Additions (+)
Subtraction (-)
Multiplication (*)
Right division (/)
MATLAB graphics
If y is a vector, plot(y) produced a linear graph
plot(x,y) produces a graph of y versus x
t = 0: pi/10: 2*pi;
x = sin(t)
y1 = sin(t+.25);
y2 = sin(t+.50);
plot(x,y1,r-,x,y2,g--)
title(Phase Shift)
xlabel(x=sin(t));
ylabel(y1=sin(t+));