MATLAB Numerical Calculations López download
MATLAB Numerical Calculations López download
https://ebookultra.com/download/matlab-numerical-calculations-
lopez/
https://ebookultra.com/download/numerical-methods-in-engineering-with-
matlab-edition-1-jaan-kiusalaas/
https://ebookultra.com/download/numerical-computing-with-matlab-
revised-reprint-2nd-edition-cleve-b-moler/
https://ebookultra.com/download/numerical-analysis-using-matlab-and-
excel-3rd-edition-steven-t-karris/
https://ebookultra.com/download/numerical-and-statistical-methods-for-
bioengineering-applications-in-matlab-1st-edition-michael-r-king/
Introduction to Numerical Ordinary and Partial
Differential Equations Using MATLAB 1st Edition Alexander
Stanoyevitch
https://ebookultra.com/download/introduction-to-numerical-ordinary-
and-partial-differential-equations-using-matlab-1st-edition-alexander-
stanoyevitch/
https://ebookultra.com/download/calculus-graphical-numerical-
algebraic-5th-edition-ross-l-finney/
https://ebookultra.com/download/computational-statistics-handbook-
with-matlab-2nd-edition-wendy-l-martinez/
https://ebookultra.com/download/exploratory-data-analysis-with-
matlab-1st-edition-wendy-l-martinez/
https://ebookultra.com/download/starting-out-the-c3-sicilian-1st-
edition-john-emms/
MATLAB Numerical Calculations López Digital Instant
Download
Author(s): López, César
ISBN(s): 9781484203460, 1484203461
Edition: Online-ausg
File Details: PDF, 9.40 MB
Year: 2015
Language: english
For your convenience Apress has placed some of the front
matter material after the index. Please use the Bookmarks
and Contents at a Glance links to access them.
Contents at a Glance
iii
Introduction
MATLAB is the tool of the modern day mathematician or engineer. The incredible deep functionality of MATLAB
makes what would have taken hours 40 years ago, often less than a minute with MATLAB built in functions. MATLAB
enables you to explore multiple approaches and reach a solution faster often more accurately than with other tools
or traditional programming languages, such as C/C++ or Java. More importantly, it has changed the way we learn
and made getting solutions immensely simpler. So, you can now focus on the application, instead of the math. And
with that easily available power, you can explore and find more and more functions, test hypotheses and become a
significantly more powerful worker.
This book is designed for use, in part, as a tool to enable you to use MATLAB as a scientific/business calculator
so that you can get numerical solutions to problems involving a wide array of mathematics using MATLAB. But it
is broader in scope than that. The book can be used as an independent resource for MATLAB. A background in the
necessary mathematics is assumed, so this book shows you how to interpret your problems to get MATLAB to do what
you want it to do. Just look up the function you want in the book and you are ready to use it in MATLAB or use the
book to learn about the enormous range of options that MATLAB offers. The book is topical, picking examples to show
not only general methods in using MATLAB, but specifics to use MATLAB for advanced mathematical computations
while giving a glimpse at their application.
MATLAB Numerical Calculations focuses on MATLAB capabilities to give you numerical solutions to problems
you are likely to encounter in your professional or scholastic life. It introduces you to the MATLAB language with
practical hands-on instructions and results, allowing you to quickly achieve your goals. Starting with a look at basic
MATLAB functionality with integers, rational numbers and real and complex numbers, and MATLAB’s relationship
with Maple, you will learn how to solve equations in MATLAB, and how to simplify the results. You will see how
MATLAB incorporates vector, matrix and character variables, and functions thereof. MATLAB is a powerful tool used
to defined, manipulate and simplify complex algebraic expressions. With MATLAB you can also work with ease in
matrix algebra, making use of commands which allow you to find eigenvalues, eigenvectors, determinants, norms and
various matrix decompositions, among many other features. Lastly, you will see how you can write scripts and use
MATLAB to explore numerical analysis, finding approximations of integrals, derivatives and numerical solutions of
differential equations.
xv
CHAPTER 1
Introduction to MATLAB
>> 4 + 3
ans =
2. We can also find the value of 3 raised to the power 100, without previously fixing the
precision. For this it is enough to simply type 3 ^ 100:
>> 3 ^ 100
ans =
5. 1538e + 047
3. We can also use the command format long e to obtain results in scientific notation with
16 more exponential digits of precision:
ans =
5.153775207320115e+047
1
CHAPTER 1 N INTRODUCTION TO MATLAB
4. We can also work with complex numbers. We find the result of the operation
raising (2 + 3i) to the power 10 by typing the expression (2 + 3i) ^ 10:
>> (2 + 3i) ^ 10
ans =
The command format long g will optimize the output of future calculations.
ans =
-341525 - 145668i
5. The previous result can also be obtained in short format using the command format short:
ans =
-3.4152e+005- 1.4567e+005i
6. We can calculate the value of the Bessel function at the point 13.5. To do this, we type
Besselj(0,13.5):
>> Besselj(0,13.5)
ans =
0.2150
7. We can also perform numerical integration. To calculate the integral between 0 and S
of sin(x), we type the expression int(sin(x), 0, pi) after having declared the variable x as
symbolic with the command syms:
>> syms x
>> int(sin(x), 0, pi)
ans =
2
CHAPTER 1 N INTRODUCTION TO MATLAB
>> syms x
>> expand (((x + 1)*(x + 2)-(x + 2)^2)^3).
ans =
>> syms x
>> factor(((x + 1)*(x + 2)-(x + 2)^2)^3)
ans =
-(x+2) ^ 3
>> syms x
>> int(x^2*sin(x)^2, x)
ans =
>> syms x
>> simplify(int(x^2*sin(x)^2, x))
ans =
3
CHAPTER 1 N INTRODUCTION TO MATLAB
>> syms x
>> pretty(simplify(int('x^2*sin(x)^2', 'x')))
2 3 2
-1/2 x cos(x) sin(x) + 1/6 x - 1/2 x cos(x) + 1/4 cos(x) sin(x) + 1/4 x
6. We can expand the function x^2 * sin(x)^2 as a power series up to order 12, presenting the
result in standard form:
>> syms x
>> pretty(taylor(x^2*sin(x)^2,12))
4 6 8 10 12
x 1/3 x + 2/45 x - 1/315 x + 0 (x)
>> syms x a
>> solve('3*a*x-7*x^2 + x^3 = 0', x)
ans =
[ 0 ]
[7/2 + 1/2 *(49-12*a) ^(1/2) ]
[7/2-1/2 *(49-12*a) ^(1/2) ]
>> syms x
>> solve('x^5+2*x+1','x')
ans =
[-.7018735688558619 -.8796971979298240 * i]
[-.7018735688558619 +.8796971979298240 * i]
[-.4863890359345430 ]
[ .9450680868231334 -.8545175144390459 * i]
[ .9450680868231334 +.8545175144390459 * i]
On the other hand, MATLAB can be used together with the Maple program libraries to work with symbolic
mathematics, thus extending its field of action. In this way, MATLAB can be used to work on topics such as differential
forms, Euclidean geometry, projective geometry, statistics, etc.
At the same time, we can extend MATLAB’s numerical calculation cababilities by using the Maple libraries
(combinatorics, optimization, number theory, statistics, etc.)
4
CHAPTER 1 N INTRODUCTION TO MATLAB
1. We can calculate the limit of the function (x^3 -1) / (x-1) as x - > 1:
>> maple('limit((x^3-1)/(x-1),x=1)')
ans =
ans =
ans =
5000
5
CHAPTER 1 N INTRODUCTION TO MATLAB
Figure 1-1.
Sometimes, depending on the type of command (user input) given to MATLAB in the Command Window, the
response will begin with the expression ans =. See Figure 1-2.
Figure 1-2.
It is important to pay attention to uppercase and lowercase characters, parentheses and square brackets, and the
use of spaces and punctuation (in particular commas and semicolons).
Like the C programming language, MATLAB is case sensitive; for example, Sin(x) is different to sin(x). The names
of all built-in functions begin with lowercase letters. Each bracket has its own meaning, as we will see later.
To indicate that two variables must be multiplied you put the symbol * between them, and there cannot be spaces
in the names of commands, variables or functions. In other cases, spaces are ignored, but they can be included to
make the input more readable.
6
CHAPTER 1 N INTRODUCTION TO MATLAB
Once a MATLAB command has been entered, simply press Enter. If at the end of the input we put a semicolon,
the program runs the calculation and keeps it in memory (Workspace), but does not display the result on screen.
The input prompt “>>” reappears to indicate that you can input a new entry.
>> 2 + 3;
>>
If the entry is too long and doesn’t fit on a single line of the MATLAB Command Window, just put three dots at
the end of the line and press Enter to continue with the rest of the entry on the next line. Once the entry is complete,
press Enter to run the command:
ans =
18361962
>>
You can make multiple entries in the same command line by separating them with commas and pressing Enter at
the end of the last entry. If you use a semicolon at the end of one of the entries of the line, its corresponding output is
ignored. If the number of consecutive entries doesn’t fit on one line, three dots are used to continue on the next line,
as described above:
ans =
ans =
ans =
13
ans =
ans =
12
7
CHAPTER 1 N INTRODUCTION TO MATLAB
To enter a descriptive comment in a command line, just start it with the “%” symbol. When you run the input,
MATLAB will ignore the comment and process the rest.
F =
127
To simplify the process of entering a script to be evaluated by the MATLAB interpreter (via the command window
prompt), you can use arrow keys. For example, if you press the up arrow once, you recover the last entry submitted in
MATLAB. If you press the up arrow twice, you recover the penultimate entry submitted, and so on.
If you type a sequence of characters in the input area and then click the up arrow, you recover the last entry that
begins with the specified string.
The commands entered during a MATLAB session are stored temporarily in the buffer (Workspace) until the end
of the session, at which time you can permanently save the session to file or lose it.
Below is a summary of the keys that can be used in the MATLAB command line, and their functions:
The command clc clears the command window, but does not delete the contents of the work area (the content
currently in memory).
8
CHAPTER 1 N INTRODUCTION TO MATLAB
MATLAB supports procedural programming (with iterative processes, recursive functions, loops...), functional
programming and object-oriented programming. Here are two simple examples of programs. The first generates the
order n Hilbert matrix, and the second calculates the Fibonacci numbers less than 1000.
9
CHAPTER 1 N INTRODUCTION TO MATLAB
>> maple('latex(Int(1/(x^4+1),x))')
ans =
>> maple('fortran(Int(1/(x^4+1),x))')
ans =
t0 = Int(1/(x**4+1),x)
ans =
t0 = Int(1/(pow(x,4.0)+1.0),x);
10
CHAPTER 2
x + y sum
x - y difference
x * y or x y product
x/y division
x ^ y power
To add two numbers, simply enter the first number, type a plus sign (+) and then enter the second number.
Spaces may be included before or after the plus sign to ease readability.
>> 53 + 78
ans =
131
11
Random documents with unrelated
content Scribd suggests to you:
with active links or immediate access to the full terms of the Project
Gutenberg™ License.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookultra.com