Tuesday, February 25, 2014

Thursday, January 23, 2014

Curve Fitting with Matlab

Matlab can be used generate a function to fit your data. Example below shows how to use Matlab's built in function to curve my test data and estimate values for non-tested points.

First, save the data in an excel file and import into Matlab using File>import data as shown below


Data is saved into a local variable most likely called "untitled". Use this variable and extract your parameters. Then call cftool to start curve fitting toolbox



Curve fitting toolbox lets you decide what kind of function you'd like to use, and outputs statistical data to let you know how good the fit occurred.




The link below shows how to do this by using an older version of Matlab.

http://www.swarthmore.edu/NatSci/echeeve1/Ref/MatlabCurveFit/MatlabCftool.html
Share:

Saturday, January 4, 2014

What is a tensor

A great explanation from http://en.wikibooks.org/wiki/General_Relativity/What_is_a_tensor%3F

tensor is a powerfully abstract entity. And while its abstractness makes it a somewhat difficult thing to describe, we can begin to get a feel for what a tensor is through a non-abstract example.
Suppose you are sailing. The wind is coming from a certain direction and can be described as a vector, a directional quantity. Now there are many ways to represent this vector. For example, you can represent it as a speed from a certain direction (\vec w). Alternatively, you can break it up into components and describe the vector as a combination of a certain amount of wind from the east and another amount from the south (\vec w'). But despite the different ways of describing this vector, there is still this underlying abstract thing -- the wind speed from a certain direction.
Now there is another important vector -- the force that the wind produces when it hits the sail. If the direction of the force were always the same as the direction of the wind, then we could represent the relationship with a scalar, which just multiples the wind vector by a constant factor to get the force vector.
However, life isn't that easy because the force is not always in the direction of the wind. In fact it usually isn't. So we can't represent the relationship between the wind and the force by a simple scalar. However, there is one important useful fact that we can use -- the relationship between the wind speed and the force on the sail is (approximately at low speeds) linear. That is, if you double the speed of the wind, you double the force. The function that computes the force from the wind is a linear operator. The fact that this operator is linear lets us represent it in terms of a matrix, relative to a given basis:
T = \begin{pmatrix} x & y \\ z & v \end{pmatrix}
Note that just like you can change the way that you represent the speed of the wind(\vec w and \vec w'), and the force it produces (\vec F and \vec F'), you can change the way that you represent the operator that connects the two. In fact, whenever you change the representations of the wind and the forces, you will have to change the matrix in order to talk about the same situation. However, just like a vector is an abstract thing that can represent the wind or the force that the wind produces when it hits the sail, there is another kind of abstract thing that you can use to represent the relation between these things. In symbols
\vec F = T \cdot \vec w
\vec F' = T' \cdot \vec w'

That thing in the middle, that T, is an example of a tensor. It is defined by the way in which T' relates to T. Tensors are really abstract things, but we now can begin to see the power of this abstractness. For one thing you can do algebra with tensors. So, say instead of one sail T, you have two sails T and U. We can represent the total force
\vec F = T \cdot \vec w + U \cdot \vec w
Now because T and U are matrices and are linear we can combine them to form a new tensor V.
\vec F = (T + U) \cdot \vec w
\vec F = V \cdot \vec w \ \mathrm{where} \ V = T + U\,
We can also multiply two tensors together. We have the force that the wind produces on the ship. Now the force that the ship produces on the water, when wind is acting on ship with force F_{wind} can be represent also as a tensor (the same way we did with wind, sail and ship):
\vec F_{ocean} = W \cdot \vec F_{wind}
\vec F_{ocean} = W \cdot V \cdot \vec w
\vec F_{ocean} = X \cdot \vec w
where tensor X = W \cdot V = W \cdot (T + U)\, characterizes ship and both sails.
Share:

What is Isotropy and anisotropy, what is anisotropic media, what is isotropic media

Anisotropy is the property of being directionally dependent, as opposed to isotropy, which implies identical properties in all directions. It can be defined as a difference, when measured along different axes, in a material's physical or mechanical properties (absorbance, refractive index, conductivity, tensile strength, etc.) An example of anisotropy is the light coming through a polarizer.
Another example for anisotropy is wood, which is easier to split along its grain than against it.

Typical transparent media such as glasses are isotropic, which means that light behaves the same way no matter which direction it is travelling in the medium.
 \mathbf{D} = \varepsilon_0  \mathbf{E} + \mathbf{P}

In an isotropic and linear medium, this polarisation field P is proportional to and parallel to the electric field E:
 \mathbf{P}  = \chi \varepsilon_0 \mathbf{E}



Share:

Saturday, November 2, 2013