iPHONE 3G

Nowadays, whenever you see 2 people talking, most probably you will hear the word ‘iPhone 3G’ in their conversation!!

That’s why I was spending some time to look around and read some reviews about this new iPhone to see whether or not it is worth buying. And I found the Cnet review one of the good reviews available on the net since they ran full battery tests showing the results for EDGE talk time, and 3G-enalbled music and video playback. They also did thorough testing of the iPhone 3G’s features.

Below is a summary of the results shown on their website:

The good: The Apple iPhone 3G offers critical new features including support for high-speed 3G networks, third-party applications, and expanded e-mail. Its call quality is improved and it continues to deliver an excellent music and video experience. Read more…

MATLAB TUTORIAL - PART VIII

Polynomials in MATLAB are defined according to there coefficients, for example:
f (x) = 5x^4 + 10x^2 + 2x + 7 is defined as :

A=[5 0 10 2 7];

Notice the “0” is added to account 0x^3

To compute the roots of A, type:

>> roots(A)
ans =
0.3323 + 1.1880i
0.3323 - 1.1880i
-0.3323 + 0.8997i
-0.3323 - 0.8997i

To evaluate A at x=3 :
>> polyval(A,3)
ans =
508

Also MATLAB supports symbols and below is a description on how to define symbols and how to do some operations using these symbols.

  • Define a symbolic variable x:

>> x=sym(’x')
x =
x

  • Integrate the following function from t=0 to t=2000:

>> int(1/sqrt(12*x+0.02*x^2),0,2000)
ans =
-5/2*2^(1/2)*log(2)+5*2^(1/2)*log(23*2^(1/2)+4*65^(1/2))-5*2^(1/2)*log(3)

  • Get a numeric evaluation of your answer:

>> eval(ans)
ans =
19.2740

Instead of inserting the commands one by one on command prompt we can directly write them in form of a code in an M-file.

MATLAB TUTORIAL - PART VII

Element-by-element operations are applied on each element of the array. As we saw earlier, addition and subtraction are already E-B-E. However, multiplication, division and exponentiation are not E-B-E but by adding the dot ‘.’ before the operator, it will behave as E-B-E. Of course in this case, matrices should be of the same size.

E-B-E operations are very useful when we have a function F(x), and we want to get the value of F(x) for several values of x. Below is an example showing how to use E-B-E:

>> X=1:6

X =
1     2     3     4     5     6
>> F=X.^2 -3.*X
F =
-2    -2     0     4    10    18

>> Y=cos(X)
Y =
0.5403   -0.4161   -0.9900   -0.6536    0.2837    0.9602

Since from now and on we will be dealing with array, it is a good idea to have a look at the functions used to analyze arrays:

  • mean(M) returns the mean of a vector or array (for each column)
  • max(M) , min(M) returns the max (min) of a vector M, and the max(min) of each column when M is a matrix
  • [p n]=max(V) , min(V)  returns the max(min) element in V, and n is the position of this element. If it happens that this max(min) is different positions, it returns the first position
  • sum(V) returns the sum of elements in vector V
  • sort(V) arranges the elements of vector V in ascending order
  • median(V) returns the median value of the elements of V
  • std(V) returns the standard deviation of the elements of V
  • det(M) returns the determinant of matrix M
  • dot(A,B) returns the dot product of A and B (scalar value)
  • cross(A,B) returns the cross product of A and B Read more…

MATLAB TUTORIAL - PART VI

Addition and subtraction are element by element operations. To use them, the two or more arrays or vectors that should be summed together of subtracted from each other should be having the same number of rows as well as columns.

On the other hand, multiplication is not an element by element operation, so the multiplication of 2 matrices is executed according to the rules of linear algebra, where if we have to matrices with sized mxn and pxq, n should be equal to p in order to perform the multiplication that results in an mxq matrix.

As you may know, matrix multiplication is not commutative. And power operations can only be done with square matrices.

When it comes to multiplying vectors, they should be of the same size where one is a row vector and the other is a column vector, and of course the result will be a 1×1 matrix. This is know as the dot product.

Another way to apply the dot product is to use the built-in function dot(A,B).

On the other hand, if we multiply a scalar value with a matrix, we will have this scalar multiplied with all of the elements in the matrix.

To solve linear algebra equations, we can represent any system with matrices.

If we have a system of 3 equations:

MATLAB TUTORIAL - PART V

In this part of the tutorial, we will cover how to add or remove elements from already defined variable.

Given a vetor of length n, assigning an element to this vector at position n+3, will add the element at that location and fill n+1 and n+2 with zeros. below is a small example showing what I mean:
>> V=[2 3]
V =
2 3
>> v(4:6)=3:3:9
v =
2 3 5 3 6 9

>> v(10)=6
v =
Columns 1 through 9
2 3 5 3 6 9 0 0 0
Column 10
6

You can also append a vector to another vector as in the following:
>> A=[12 4 5];B=[1:2:6];
>> C=[A B]
C =
12 4 5 1 3 5

Adding elements to a matrix follow the same logic using the addressing techniques that we learned in the previous part of the tutorial, but here we can’t elements, we have to add new rows or new columns or both.

>> M=[1 3 4 5;3 2 3 5]
M =
1 3 4 5
3 2 3 5
>> M(4,:)=[4 4 4 4]
M =
1 3 4 5
3 2 3 5
0 0 0 0
4 4 4 4
Note that assigning a new value to an element beyond the matrix size, causes MATLAB to increase the matrix size in order to include the new element by assigning zeros to the other newly added elements

Also we can append a matrix to another one as in the following example:
M =
1 3 4 5
3 2 3 5
0 0 0 0
4 4 4 4
>> K=ones(4,2) Read more…

MATLAB TUTORIAL - PART IV

Since we will be dealing with matrices a lot, it is always good to learn some matrix and vector operations. And one of the mostly used operations is the transpose operation, where if applied to a vector, it will switch row(column) to column(row), and when it is applied to a matrix, it will switch rows(columns) to columns(rows). And it is applied when typing ‘ to the variable as shown in the example below:

>> a3
a3 =
1     3     5
1     3     4
23    41    59

>> a3′
ans =
1     1    23
3     3    41
5     4    59

And since the basic elemet of MATLAB is the array, it is good to master the addressing of its elements. You can address individual elements or subgroups in a matrix or vector.

In the case of vectors, all you have to do is to execute vector(k) where k is the position of the element that we want. While in the case of matrices, we have to specify the number of row and the number of column of the element wthat we want. so Matrix(k,p) will give you the element at the intersection between row k and column p. Of course you can change the value at that location by executing:

Vector(k)=newvalue

Matrix(k,p)=new value

Here is an example to address an element in a vector:

v =
2     3     5     6    77     7
>> v(3) Read more…

MATLAB TUTORIAL - PART III

As we have mentioned earlier, Arrays are fundamental forms used to in MATLAB to store and manipulate data.
It is a list of numbers arranged in rows and/or columns. And of course, the simplest array, is a one dimensional array which is know as a Vector.
And a vector can be of 2 forms, either a row vector or a column vector.
We should note that Arrays can handle numbers as well as charaters and strings.

A one dimensional array, can be used for example to represent the position of a point in space.
Of course, there are several ways to create a vector depending on the source of information which can be specific numbers or mathematical expressions or a series of elements with constant spacing.

Below are some of the different forms:

  • If you have a certain number of data like the profit of a company between in years 1988 1989 1990 1991

You can directly represent the info above by:

>> year=[1988 1989 1990 1991]
year =
1988        1989        1990        1991
>> profit=[10000;15000;8000;1000]
profit =
10000
15000
8000
1000

  • Vectors with constant spacing

Vector_name=a:n:b

where a is the first term, n is the spacing , and b is the last term.

If we remove n, the default spacing will be equal to 1. Below is a example on how to use this vector spacing:

>> x=2:2:10
x =
2     4     6     8    10 Read more…

MATLAB TUTORIAL - PART II

The default display format is the ’short’ where we have 4 decimal digits after the fixed point. We can always change the format by typing the format command, and for more info about parameters to use, type ‘help format’ in the command window.

Below you can find the commands that can be used, with their description and an example on each case:

  1. format short: fixed point with 4 decimal digits >> 280/6ans =46.6667
  2. format long: fixed point with 14 decimal digits>> 280/6ans =46.666666666666664
  3. format short e: scientific notation with 4 decimal digits>> 280/6ans =4.6667e+001
  4. format long e: scientific notation with 15 decimal digits>> 280/6ans =4.666666666666666e+001
  5. format short g: best of 5-digit fixed or floating point>> 280/6ans =46.667
  6. format long g: best of 15-digit fixed or floating point>> 280/6ans =46.6666666666667
  7. format bank: two decimal digits>> 280/6ans =46.67
  8. format compact: eliminates empty lines to allow more lines with info to be displayed on the screen Read more…

MATLAB TUTORIAL - PART I

MATLAB is a powerful language for technical computing.

MATLAB means MATrix LABoratory, since the basic element in MATLAB is a matrix.

It is a very helpful mathematical tool used in all engineering computations, modelling and simulation, data analysis and processing, visualization and graphics, as well as algorithm development.

As you may know, MATLAB is huge so it is impossible to cover all MATLAB at once. So we will focus here on the foundations of MATLAB, and once understood, any topic will be easily understood. And of course, the HELP menu is a very rich source of information in case we are stuck.

In this part of the tutorial, we will describe the different windows in MATLAB, while concentrating on the Command Window. We will also deal with arithmetic operations with scalars. Of course, we will define the scalar variable first and then introduce the elementary math functions that can be applied on scalars.

The default view of MATLAB consists of 3 main windows which are :

  1. Command window
  2. Current directory window
  3. Command history window

And there is the start button in the lower left corner of the screen which is used to access MATLAB tools and features.

The purposes of the windows in addition to the 3 windows mentioned above are listed below:

  • Command window: main window, enters variables, runs programs
  • Figure window: contains output from graphic commands
  • Editor window: creates and debugs script and function files
  • Help window: provides help information
  • Launch pad window: provides access to tools, demos and documentations
  • Command history window: logs commands entered in the command window
  • Workspace Window: provides information about the variables that are used
  • Current directory window: shows the files in the current directory Read more…

POOR QUALITY SLEEP LINKED TO ELEVATED BLOOD PRESSURE IN TEENS

Can you imagine that something as simple as improper sleep can be one of the causes of elevated blood pressure?

This is a well known fact for adults, but recently a new study suggests that there is a link between inadequate, low-quality sleep and healthy teen.

Teenagers with inefficient sleep (meaning they have trouble falling asleep or wake early) and those with insufficient sleep (less or equal to 6.5 hours a day) had an increased risk of having elevated blood pressure.

Even after adjustment for other possible contributing factors, teens with poor sleeping patterns had systolic blood-pressure levels that were on average 4 mm Hg higher than other children; which is really significant.

This is just one reason to push us more into giving our sleep time more importance. There are several other reasons.

So sleep well from now on!!!!!