# Element by Element Operations in Matlab Programming

## Get Matlab Help Now..!

When doing MATLAB element by element operations, rather than explicitly iterating in a loop, MATLAB will repeat evaluation process on each element in a vector automatically. Of course, this only happens if someone specify the element by element math with the proper syntax!
This is process can be best demonstrated with an example.
lets Assume that the height of a ball thrown from a roof is described by the equation:
MATLAB code calculates the height of the ball at every second between zero and 10?
To solve this in MATLAB, a vector of time values should be defined:
>> t = [1:10]
t = 0 1 2 3 4 5 6 7 8 9 10
Next, A equation for the height of the ball should be typed in with some special syntax to indicate we want MATLAB to perform the evaluation element-by-element. Before any multiplication, division, or exponent a dot (.) should be placed to specify this. In other words, we are telling MATLAB to calculate the height of the ball for every value of the vector of time t and return to us a vector of the answers:
>> y = 1000+70.*t-16.1.*t.^2
y = 1.0e+03 *
The MATLAB give the height of ball and gives the output in the following format:
1.0000 1.0539 1.0756 1.0651 1.0224 0.9475 0.8404 0.7011 0.5296 0.3259 0.0900
The above written values are calculated height of ball at 0 seconds to 10 seconds starting from left respectively
The above written output can be divided into two different rows if your command window is not wide enough to display the contents of the entire vector on a single line.