Professional Documents
Culture Documents
Engineering Computer Applications: Dr. Lubna Badri Second Semester 2013-2014
Engineering Computer Applications: Dr. Lubna Badri Second Semester 2013-2014
Applications
(0904 201)
Dr. Lubna
Badri
Second
Semester
2013-2014
Polynomial Roots
To find the roots of x37x2+ 40x34 = 0, the session is
;a = [1,-7,40,-34]<<
roots(a)<<
=ans
5.000i + 3.0000
5.000i -3.0000
1.0000
.The roots are x= 1 and x= 3 5i
1. The name of a script file must begin with a letter, and may
include digits and the underscore character, up to 31
characters.
2. Do not give a script file the same name as a variable.
Programming Style
1. Comments section:
The name of the program and any key words in the first
line.
The date created, and the creators' names in the second line.
The definitions of the variable names for every input and
output variable. Include definitions of variables used in the
calculations and units of measurement for all input and all
output variables!
The name of every user-defined function called by the
program.
Programming Style
2. Input section:
Include input data and/or the input functions and comments for
documentation.
3. Calculation section
4. Output section:
This section might contain functions for displaying the output
on the screen.
Example
1. The force f1(t) in newtons (N) in a certain industrial process
in increases with the square of time over a particular time
interval and can be expressed as
f1(t) = 0.25t2
Use MATLAB to plot the function from t = 0 to t = 10 s
2. Assume that a force in newtons (N) is given by
f2(t) = 0.25t2 + 25.
Plot the force over the time interval from 0 to 10 s.
:Homework