Wednesday, 25 September 2013

MATHS OF ECG WAVES BY FOURIER SERIES

I think its intersting to know that fourier series can use for read ECG waves.  The research is done by Dr. Murray Bourne.
ECG waves look like this. According Dr. Murray Bourne-
HOW ECG IS DONE -
The electrodes are connected to various parts of your anatomy (chest, legs, arms, feet) and voltage differences over time are measured to give the ECG readout.
The horizontal axis of the ECG printout represents time and the vertical axis is the amplitude of the voltage.
ecg - reference pulse
Amplitude units are millivolts (mV) and on the graph, 1 mV = 10 mm high.
The time scale is 25 mm = 1 second (or 1 mm per 0.04 seconds on the graph).
So here’s Murray Bourne readout forLead II, representing the voltage between the positive electrode on my left leg and the electrode on my right arm. Each thicker red vertical line represents a time of 1 second.
ECG II

Apparently (according to the doctor), this indicates my heart is quite healthy.
In more detail, the features of the repeated pulse we are looking at are as follows.
PQRST waves ECG
The P wave is caused by contraction of the right atrium followed by the left atrium (the chambers at the top of the heart).
The QRS complex represent the point in time when most of the heart muscles are in action, so has highest amplitude.
The T wave represents the polarization of the ventricles (the chambers at the bottom of the heart).
heart


Modeling the Heartbeat Using Fourier Series-

A heartbeat is roughly regular (if it isn’t, it indicates something is wrong). Mathematically, we say something that repeats regularly isperiodic.
Such waves can be represented using a Fourier Series.


Assumptions-

In my case, my heart rate was about 70 beats per minute. For the sake of simplicity, I’ll assume 60 beats per minute or 1 per second. So the period = 1 second = 1000 milliseconds.

Also for simplicity, I will only model the R wave for this article. To get a more accurate model for the heartbeat, I would just need to do a similar process for the P, Q, S and T waves and add them to my model.

I observed that my R wave was about 2.5 mV high and lasted for a total of 40 ms. The shape of the R wave is almost triangular and so I could have used straight lines for my model, but these son’t give us a smooth curve.

A beter approach is to use a polynomial and ascending and descending lines are close enough to being straight, so my model is as follows (the time units are milliseconds):

f(t) = -0.0000156(t − 20)⁴ + 2.5
f(t) = f(t + 1000)

Explanation of the Model

The model is based on a quartic (power 4) since this will give me close to the shape I need (a parabola would be too broad).

The (t − 20) term comes from deciding the curve should start at (0,0), pass through (40,0) since the pulse is 40 ms long, and be centered on t = 20
The "+2.5" comes from the fact the amplitude of the pulse is 2.5 mV.

The -0.0000156 comes from solving
a(t − 20)⁴ + 2.5 = 0.

The "f(t) = f(t + 1000)" part means the function (pulse in this case) is repeated every 1000 ms.

Graph of the Model

This is the graph of part of one period:
ECG model
Of course. this is just one pulse. How do we produce a graph that repeats this pulse at regular intervals?
This is where we use Fourier Series.
I’ll spare you all the details, but essentially the Fourier Series is an infinite series involving trigonometric terms. When all the terms are added, you get a mathematical model of the original periodic function.
To obtain the Fourier Series, wee need to find the mean valuea0, and 2 coefficient expressions involving nan and bn which are multiplied by trigonometric terms and summed for n = 1 to infinity.

Mean Value Term

a0 is obtained by integration as follows (L is half of the period):
a_{0}=\dfrac{1}{L}\int_{-L}^{L}f(t)dt
=\dfrac{1}{500}\int_{-500}^{500}f(t)dt
=\dfrac{1}{500}\int_{0}^{40}(-0.0000156(t-20)^{4}+2.5)dt
=0.16

First Coefficient Term, an

Next, we compute an:
a_{n}=\frac{1}{L}\int_{-L}^{L}f(t)\cos\frac{n\pi{t}}{L}dt
=\dfrac{1}{500}\int_{-500}^{500}f(t)\cos\frac{n\pi{t}}{500}dt
=\dfrac{1}{500}\int_{0}^{40}(-0.0000156(t-20)^{4}+2.5)\cos\frac{n\pi{t}}{500}dt
The answer for this integral is pretty ugly. I’ve included it in the PDF solution.

Second Coefficient Term, bn

Now for bn:
b_{n}=\frac{1}{L}\int_{-L}^{L}f(t)\sin\frac{n\pi{t}}{L}dt
=\dfrac{1}{500}\int_{-500}^{500}f(t)\sin\frac{n\pi{t}}{500}dt
=\dfrac{1}{500}\int_{0}^{40}(-0.0000156(t-20)^{4}+2.5)\sin\frac{n\pi{t}}{500}dt
Once again, I have spared you from the full details.
Finally, we put it all together and obtain the Fourier Series for our simple model of a heart beat:
f(t)=\dfrac{a_{0}}{2}+\sum_{n=1}^{\infty}a_{n}\cos\dfrac{n\pi{t}}{L}+\sum_{n=1}^{\infty}b_{n}\sin\dfrac{n\pi{t}}{L}
f(t)=\dfrac{0.16}{2}
+\sum_{n=1}^{\infty}\left(\dfrac{1}{500}\int_{0}^{40}(-0.0000156(t-20)^{4}+2.5)\cos\frac{n\pi{t}}{500}dt\right)\cos\dfrac{n\pi{t}}{500}
+\sum_{n=1}^{\infty}\left(\dfrac{1}{500}\int_{0}^{40}(-0.0000156(t-20)^{4}+2.5)\sin\frac{n\pi{t}}{500}dt\right)\sin\dfrac{n\pi{t}}{500}
When we graph this for just the first 5 terms (n = 1 to 5), we can see the beginnings of a regular 1-second heart beat.
ECG model n=5
The above graph shows the "noise" you get in a Fourier Series expansion, especially if you haven’t taken enough terms.
Taking more terms (this time, adding the first 100 terms) gives us the following, and we see we get a reasonable approximation for a regular R wave with period 1 second.
ECG model
I added the T wave for this next model (in blue).
ECG model
We could keep going, adding the P, Q and S waves to get an even better model.
See the complete solution (up to the T wave, created using Scientific notebook) here:


Monday, 23 September 2013

Steps to live happy life

(1).
   Don't care about others even the person is very close to you . If you care some one then u will asks questions to that person. The person can hurt you .
(2). 
Let that no one is yours and don't care what the others are doing . 
(3).

Don't care what the others have and what can they do just think what you can do.
(4).
Do the things which keeps you busy. 
(5).
If u love n care someone then dont expect about the same care n love from that person in return . Its very important . If you can that then can but if u expect the same love n care then ........... 
(6).
Cut your ego and atitude if you wanna live happy . Have positive atitude not negtive.
(7).
And at last i wanna say sorry if i hurt some one or if some one get hurted by this post .

Monday, 2 September 2013

Future Water Levels of Crucial Agricultural Aquifer Forecast

If current irrigation trends continue, 69 percent of the groundwater stored in the High Plains Aquifer of Kansas will be depleted in 50 years. But immediately reducing water use could extend the aquifer's lifetime and increase net agricultural production through the year 2110.Those findings are part of a recently published study by David Steward, professor of civil engineering, and colleagues at Kansas State University. The study investigates the future availability of groundwater in the High Plains Aquifer -- also called the Ogallala Aquifer -- and how reducing use would affect cattle and crops. The aquifer supplies 30 percent of the nation's irrigated groundwater and serves as the most agriculturally important irrigation in Kansas.
"Tapping unsustainable groundwater stores for agricultural production in the High Plains Aquifer of Kansas, projections to 2110" appears in the scientific journal Proceedings of the National Academy of Sciences, or PNAS. The study took four years to complete and was funded by the National Science Foundation, the U.S. Department of Agriculture and Kansas State University's Rural Transportation Institute.
"I think it's generally understood that the groundwater levels are going down and that at some point in the future groundwater pumping rates are going to have to decrease," Steward said. "However, there are lots of questions about how long the water will last, how long the aquifer will take to refill and what society can do."
Steward conducted the study with Kansas State University's Michael Apley, professor of clinical sciences and an expert in cattle production; Stephen Welch, professor of agronomy, who helped with a statistics method called bootstrapping; Scott Staggenborg, adjunct professor in agronomy who studies agricultural production methods; Paul Bruss, a 2011 master's degree graduate in civil engineering; and Xiaoying Yang, a former postdoctoral research assistant who is now at Fudan University in China.
Using measurements of groundwater levels in the past and present day in those regions, Steward and colleagues developed a statistical model that projected groundwater declines in western Kansas for the next 100 years and the effect it will have to cattle and crops.
According to their model, researchers estimated that 3 percent of the aquifer's water had been used by 1960. By 2010, 30 percent of the aquifer's water had been tapped. An additional 39 percent of the aquifer's reserve is projected to be used by 2060 -- resulting in the loss of 69 percent of the aquifer's groundwater given current use. Once depleted, the aquifer could take an average of 500-1,300 years to completely refill given current recharge rates, Steward said.
Although the High Plains Aquifer will continue declining, researchers anticipate even greater efficiencies in water use during the next 15-20 years.
"Society has been really smart about using water more efficiently, and it shows," Steward said. "Water use efficiencies have increased by about 2 percent a year in Kansas, which means that every year we're growing about 2 percent more crop for each unit of water. That's happening because of increased irrigation technology, crop genetics and water management strategies."
As a result, researchers anticipate that while peak water use will happen around 2025, western Kansas will see increased corn and cattle production until the year 2040. What happens past that time frame depends on what decisions are made about reducing the use of the aquifer's water in the near future, Steward said.
The team conducted several hypothetical scenarios that reduced the current pumping rate by 20 percent, 40 percent, 60 percent and 80 percent. Steward said the researchers went as high as 80 percent because that closely aligned with the aquifer's natural groundwater recharge rate of about 15 percent of current pumping.
"The main idea is that if we're able to save water today, it will result in a substantial increase in the number of years that we will have irrigated agriculture in Kansas," Steward said. "We'll be able to get more crop in the future and more total crop production from each unit of water because those efficiencies are projected to increase in the future."
Steward said he hoped the study helps support the current dialogue about decisions affecting how water can help build resiliency for agriculture in the future.
"We really wrote the paper for the family farmer who wants to pass his land on to his grandchildren knowing that they will have the same opportunities that farmers do today," Steward said. "As a society, we have an opportunity to make some important decisions that will have consequences for future generations, who may or may not be limited by those decisions."