This preview shows pages 1–3. Sign up to view the full content.
Introduction to Matlab, II
for
MAP 4103, Mathematical Modelling I, Spring 2011
Xin Li
Department of Mathematics
University of Central Florida
Matlab is indeed a programming language. It is an
advanced programming
language
in the sense that its syntax is very much like human language. Un
like other programming language like FORTRAN, PASCAL, LISP, BASIC,
C, C++, .
.., Matlab is interactive like a handheld calculator. No compiling
is required!
Here is an example of a simple Matlab program referred to as
script
in
Matlab.
function y=aq(a,q,n)
%This function calculates (a;q)_n=(1a)(1aq).
..(1aq^{n1})
%Inputs: a  any real number
%
q  a number between 0 and 1
%
n  a positive integer
%Author: Xin Li
%Version: 1.0
%Comments: This function is built for the study of qAiry
%
function and its partial sums
y=1; %initial value of the product
qi=1; %initial value for the power of q
for i=1:n
y=y*(1a*qi);
qi=qi*q;
end
Do not worry too much about what the program does for the moment.
Let’s make sure we understand all the individual parts ﬁrst.
1
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document A Detailed Explanation.
The program starts with the keyword “function”
followed by an “equality”. Of course this is not your usual equality. It is
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 01/16/2012 for the course MAD 4103 taught by Professor Li during the Spring '11 term at University of Central Florida.
 Spring '11
 Li

Click to edit the document details