A script is a sequence of ordinary
statements and functions used at the command prompt level. A script
is
invoked the command prompt level by typing the file-name or by
using the pull down menu. Scripts can also
invoke other scripts.
If you have any question or need some help, leave a comment below.
READ MORE
The commands in the Command Window
cannot be saved and executed again. Also, the Command Window is not interactive. To overcome
these difficulties, the procedure is first to create a file with a
list of
commands, save it and then run the file. In this way, the
commands contained are executed in the order they
are listed when
the file is run. In addition, as the need arises, one can change or
modify the commands in the
file; the file can be saved and run
again. The files that are used in this fashion are known as script
files. Thus,
a script file is a text file that contains a sequence
of MATLAB commands. Script file can be edited (corrected
and/or
changed) and executed many times.
Creating and Saving a Script File
Any text editor
can be used to create script files. In MATLAB, script files are
created and edited in the Editor/
Debugger Window. This window can be
opened from the Command Window. From the
Command Window,
select File, New and then M-file. Once the window is open, the
commands of the script file are typed line by
line. The commands can
also be typed in any text editor or word processor program and then
copied and
pasted in the Editor/Debugger Window. The second type of
M-files is the function file. Function file enables
the user to
extend the basic library functions by adding ones own computational
procedures. Function
M-files are expected to return one or more
results. Script files and function files may include reference to
other
MATLAB toolbox routines.
MATLAB function
file begins with a header statement of the form:
function (name
of result or results) = name (argument list)
Before a script
file can be executed it must be saved. All script files must be saved
with the extension “.m”.
MATLAB refers to them as M-files. When
using MATLAB M-files editor, the files will automatically be saved
with a “.m” extension. If any other text editor is used, the file
must be saved with the “.m” extension, or
MATLAB will not be
able to find and run the script file. This is done by choosing Save
As... from the File
menu, selecting a location, and entering a name
for the file. The names of user defined variables, predefined
variables, MATLAB commands or functions should not be used to name
script files.
Running a Script File
A script file can
be executed either by typing its name in the Command Window and then
pressing the Enter
key, directly from the Editor Window by clicking
on the Run icon. The file is assumed to be in the current
directory,
or in the search path.
Input to a Script File
There are three
ways of assigning a value to a variable in a script file.
1. The variable is
defined and assigned value in the script file.
2. The variable is
defined and assigned value in the Command Window.
3. The variable is
defined in the script file, but a specified value is entered in the
Command Window
when the script file is executed.
References:
1. 'Matlab An
Introduction with Applications', Rao V. Dukkipati
2. 'Matlab Ders
Notları', Hasan Korkmaz
3.
http://mathworks.com
If you have any question or need some help, leave a comment below.
Matlab contains a number functions for performing computations, there are give in the tables below:
READ MORE
Function | Description |
---|---|
abs(x) sqrt(x) round(x) fix(x) floor(x) ceil(x) sign(x) rem(x,y) exp(x) log(x) log10(x) |
Computes the absolute value of x. Computes the square root of x. Rounds x to the nearest integer. Rounds (or truncates) x to the nearest integer toward 0. Rounds x to the nearest integer toward –∞. Rounds x to the nearest integer toward ∞. Returns a value of –1 if x is less than 0, a value of 0 if x equals 0, and a value of 1 otherwise. Returns the remainder of x/y. for example, rem(25, 4) is 1, and rem(100, 21) is 16. This function is also called a modulus function. Computes ex, where e is the base for natural logarithms, or approximately 2.718282. Computes ln x, the natural logarithm of x to the base e. Computes log10 x, the common logarithm of x to the base 10. |
Function | Description |
---|---|
exp(x)
log(x)
log10(x)
sqrt(x)
|
Exponential (ex) Natural logarithm Base 10 logarithm Square root |
Table 3: Trigonometric and hyperbolic functions
Function |
Description |
sin(x)
cos(x) tan(x) asin(x) acos(x) atan(x) atan2(y,x) sinh(x) cosh(x) tanh(x) asinh(x) acosh(x) atanh(x) |
Computes the sine of x, where x is in radians.
Computes the cosine of x, where x is in radians. Computes the tangent of x, where x is in radians. Computes the arcsine or inverse sine of x, where x must be between –1 and 1. The function returns an angle in radians between –π/2 and π/2. Computes the arccosine or inverse cosine of x, where x must be between –1 and 1. The function returns an angle in radians between 0 and π. Computes the arctangent or inverse tangent of x. The function returns an angle in radians between –π/2 and π/2. Computes the arctangent or inverse tangent of the value y/x. The function returns an angle in radians that will be between –π and π, depending on the signs of x and y. Computes the hyperbolic sine of x. Computes the hyperbolic cosine of x. Computes the hyperbolic tangent of x. Computes the inverse hyperbolic sine of x. Computes the inverse hyperbolic cosine of x. Computes the inverse hyperbolic tangent of x. |
Table 4: Round-off functions
Function |
Description |
Example |
round(x) |
Round to the nearest integer
. |
>> round(20/6)
ans = 3 |
fix(x) |
Round towards zero
. |
>> fix(13/6)
ans = 2 |
ceil(x) |
Round towards infinity
|
>> ceil(13/5)
ans = 3 |
floor(x) |
Round towards minus infinity
|
>> floor(–10/4)
ans = –3 |
rem(x,y) |
Returns the remainder after x is divided by y
|
>> rem(14,3)
ans = 2 |
sign(x,y) |
Signum function. Returns 1 if x > 0, –1 if x < 0,
and
0 if x = 0.
|
>> sign(7)
ans = 1 |
Table 5: Complex number functions
Function |
Description |
conj(x)
angle(x) real(x) imag(x) abs(x) |
Computes the complex conjugate of the complex number x. Thus,
if
x is equal to a + ib, then conj(x) will be equal to a – ib.
Returns
the phase angles, in radians, for each element of complex array Z.
Computes the real portion of the complex number x.
Computes the imaginary portion of the complex number x. Computes the angle using the value of atan2(imag(x), real(x)); thus, the angle value is between –π and π. |
Horror. Starring Vera Farmiga, Patrick Wilson.Lili Taylor and Ron Livingston. Directed by James Wan. (R. 112 minutes.)
James Wan, for better or worse, seemed destined to be known as "the guy who made 'Saw' " - a film that ushered in the recent era of torture porn cinema.
Never mind that he's directed four movies since then. Never mind that in the hazy memory created by six diminishing sequels, people forget that the original "Saw" was a decent piece of filmmaking. (With less torture than you remember.) Wan was on track to endure a lifetime of sideways looks when he got introduced at parties.
If there's any fairness, he'll now be known as "the guy who made 'The Conjuring.' " The horror movie is artfully crafted from the first scares to the closing credits, with a bold retro vibe. But while its closest cousins are "The Exorcist" and the original "The Amityville Horror," Wan understands that modern audiences have short attention spans. The scares here begin in the pre-credits sequence, and barely let up until the end.
The throwback horror genre has been percolating for years in art houses - most notably with talented young Ti West's "The House of the Devil" and "The Innkeepers." Although West prefers a minimalist approach with a slow build, Wan aims for a more epic style.
"The Conjuring" introduces us quickly to Ed and Lorraine Warren (Patrick Wilson and Vera Farmiga), demonologists who believe in the occult, but understand that most events are easily explained hoaxes. Next we meet the Perron family - Carolyn, Roger and their five girls. With their 1970s clothing and sensibilities, the family is recognizable and realistic, with seasoned Ron Livingston and Lili Taylor in parental roles.
The Perrons have invested too much in an old house, which they gradually learn is haunted by spirits who mean to do them harm. They quickly hook up with the Warrens, who want evidence of the paranormal events before calling in an exorcist. The Perrons agree, after being told that these demons will follow them if they leave. The tale is tied together well - at no point does the plot require anyone to make idiotic decisions in the name of narrative momentum.
Wan's boldest move is his reliance on practical effects, which enhance the 1972 setting. A storm of crows looks more like something from "The Birds" than a modern movie apocalypse. Demons are clearly played by made-up actors. The postproduction digital effects bill couldn't have topped the low six figures - and yet nothing feels skimpy.
The weakness of "The Conjuring" is repetition. There are multiple sequences where a Perron lights the basement with matches, sleepwalks or investigates an armoire, and scenes start to blend together in the 112-minute run time. (The emotionally satisfying ending makes up for minor editing issues.)
Although the budget was likely modest, attention to detail is rich. The musical score sets a menacing tone and is also an effective tease, changing things up to avoid tipping off the audience. As action builds, the camera work seems to get a little shakier and rise to impossible angles, as if the demons are handling the cinematography as well.
The actors are all committed to Wan's vision, but Taylor stands out, giving everything to a complex and constantly shifting role. Writers Chad and Carey Hayes are also assets, resisting the horror movie urge to overexplain. They craft memorable scenes, but also include mystery, ensuring that new things will be discovered upon repeat viewings.
There are two kinds of people who won't like this film: those who hate all horror movies, and a less mature crowd not ready to experiment beyond the cheaper thrills of the "Paranormal Activity" or "Final Destination" templates. (That latter group doesn't trust mainstream movie reviews, so this glowing take should provide adequate warning.)
As the critic in charge of putting together this publication's summer movie preview, I barely considered "The Conjuring" worthy of mention. That was clearly a mistake. I'd be shocked if we see a better horror film in 2013.
source:http://www.sfgate.com
Peter Hartlaub is The San Francisco Chronicle's pop culture critic. E-mail:phartlaub@sfchronicle.com Twitter: @PeterHartlaub
Read it In my new Blog with Updates!
Hi guys! Nowadays most of the people have a trouble with Android x86 wifi-wireless problem.
To handle this I figured out a solution.
Solution:
Open Android and press Ctrl+Alt+F1 to open terminal then type the following rows:
netcfg --to see what you have as connection devices in your computer
probably you see lo,eth0 and maybe eth1--
then type
netcfg eth0 up --to open eth0-- after that type
netcfg setprop net.dns1 8.8.8.8
close the terminal by pressing Ctrl+Alt+F7
And have fun with your net connection.
This solution is worked for a friend. Maybe it will work for you too!.
READ MORE
Hi guys! Nowadays most of the people have a trouble with Android x86 wifi-wireless problem.
To handle this I figured out a solution.
Solution:
Open Android and press Ctrl+Alt+F1 to open terminal then type the following rows:
netcfg --to see what you have as connection devices in your computer
probably you see lo,eth0 and maybe eth1--
then type
netcfg eth0 up --to open eth0-- after that type
netcfg setprop net.dns1 8.8.8.8
close the terminal by pressing Ctrl+Alt+F7
And have fun with your net connection.
This solution is worked for a friend. Maybe it will work for you too!.