Google

Sunday, August 31, 2008

Top 10 Matlab Commands for Linear Algebra Students

1. basic input: "A = [ 1 2 3; -1 2 3; 2 4 5 ]" inputs a 3x3 matrix by rows; variants
"b = [ -1 2 1]' " or "b = [ -1; 2; 1]" to input a column vector b, and
"C = [ A b ]" to produce a matrix C containing A augmented with b.
Note: "format compact" reduces output spaces; also try "format long", "format rat", "help format".
2. rref: "rref(A)" reduces A to reduced echelon form; see also "rrefmovie(A)".
3. basic arithmetic: "A*B", "A+B", "A\b" to multiply and add matrices, solve Ax = b.
4. help: "help command" gives information about "command", e.g. "help rref".
Note: "more on" gives output (e.g. from help) one screen at a time.
5. lookfor: "lookfor keyword" tries to find commands relevant to "keyword"; e.g. "lookfor null".
6. diary: "diary myfile" records subsequent output in the file "myfile" for printing later;
"diary off" stops the recording; "!mail name@email.address < myfile" emails "myfile" to "name@email.address" from a computer with a Unix OS.
7. rand: "rand(6,4)" produces a random 6x4 matrix.
8. det: "det(A)" computes the determinant of a square matrix A.
9. inv: "inv(A)" tries to compute the inverse of a square matrix A.
10. eig: "eig(A)" computes eigenvalues(vectors) for square A; try "help eig" for more info.

Note: the uparrow key gives previous commands that may be edited to save typing; this only works if your keyboard characterstics are properly recognized.

MATLAB

What is Matlab?

Matlab (short for MATrix LABoratory) is a language for technical computing, developed by the The Mathworks, Inc. It provides a single platform for computation, visualization, programming and software development. All problems and solutions in Matlab are expressed in notation used in linear algebra and essentially involve operations using matrices and vectors.
As part of the undergraduate Electrical Engineering program, you will be using Matlab to solve problems in

* Circuits
* Communication systems
* Digital signal processing
* Control systems
* Probability and statistics

In addition, you can use Matlab to build Graphical User Interfaces (GUIs) so that you can develop user-friendly custom software.
The Matlab software environment has a core module (called Matlab) and associated with that are a set of "Toolboxes" that perform specialized computations.

Matlab Tutorial
The tutorial is organized into the following sections; just follow the links. The best way to learn Matlab is by actually doing the examples indicated.

* Getting Started
* Vectors and Matrices
* Vector and Matrix Operations
* Loops
* Plotting
* Printing
* File Input/Output
* Executable files (m-files) in Matlab

Getting Started

Note: In all of the discussion in the following sections, stuff that you type in will be written in boldface. All Matlab output will be normal font.

Double click on the Matlab icon to start the program (duh....). A MATLAB Command Window should pop-up with the following text:

To get started, type one of these commands: helpwin, helpdesk, or demo.
>>

The ">>" is a prompt, requiring you to type in commands. One of the first commands you should type in is to find out what your working directory is. The working directory is where you will save the results of your calculations. So, type in
>> pwd
pwd stands for "print working directory". You probably would get an output like:

ans =

\\ENGNET\MATLAB\bin

Matlab always stores the result of its last calculation in a variable called ans (short for answer). Now this indicates the working directory. You can change the working directory using the cd (short for change directory) command. Do
>> cd C:\temp
>> pwd

ans =

C:\temp

Now, the results of your computations will be saved in the C:\temp directory, when you issue the correct commands (more about that later).

Online help can be accessed for all Matlab commands by issuing the help command.
>> help

To get started, you can simply type
>> help

Vectors and Matrices
Variables in Matlab are just like variables in any other programming language (C, C++ etc.); only difference is that you do not have to define them by indicating the type etc. Also, variable names (case sensitive) can be used to refer to a single number (a scalar), a set of numbers (a vector) or an array of numbers (a matrix).
Vectors are nothing but matrices having a single row (a row vector), or a single column (a column vector).
To create a row vector in Matlab, do:
>> r = [1 2 3 4]

r =
1 2 3 4

A column vector can be created by
>> c = [1; 2; 3; 4]
c =

1
2
3
4
On the other hand, you can use the ' operator (transpose)
>> c = r'
c =

1
2
3
4

Vectors can also be created by incrementing a starting value with a constant quantity. For example,
>> r = [0:2:10]
r =

0 2 4 6 8 10
creates a row vector, with the first element = 0; each element inceremented by 2; until the final value of 10.

You can index specific parts of a vector. For example, to get the third element in the vector r, you can do
>> r(3)

ans =

4

Matrices are 2 dimensional quantities and are created similar to vectors. We can do
>> a = [1 2 3; 4 5 6; 7 8 9; 10 11 12]
a =

1 2 3
4 5 6
7 8 9
10 11 12
which is a 4x3 matrix (4 rows and 3 columns). We can also use the incremenation principle to do
>> b = [0:2:10; 1:2:11]
b =

0 2 4 6 8 10
1 3 5 7 9 11
which is a 2x6 matrix. Again, individual elements of the matrix, for instance the element in the 2nd row, 5th column can be accessed using the notation:
>> b(2, 5)
ans =

9

Vector and Matrix Operations

The basic arithmetic operations +, -, *, / can be used for vectors and matrices. These would generate corresponding output vectors or matrices. For example, to add two vectors:
>> a = [1 2 3 4];
>> b = [5 6 7 8];
>> c = a+b
c =
6 8 19 12

The semicolons (;) in the first two commands direct Matlab not to echo the values of the variables a and b on to the screen immediately after you type them. Obviously, only vectors that have the same number of elements can be added or subtracted. Similarly, two matrices with identical number of rows and columns can be subtracted as follows:
>> a = [1:3:20; 21:3:40];
>> b = [2:3:20; 22:3:40];
>> c = a-b
c =

-1 -1 -1 -1 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1

Matrix multiplication using the * symbol is possible only if the number of columns in the first matrix equals the number of rows in the second:
>> a=[1 2 3; 4 5 6]
a =

1 2 3
4 5 6

>> b = a'
b =

1 4
2 5
3 6

>> c=a*b

c =

14 32
32 77

However, if you want to multiply corresponding elements of two matrices, then you do an array multiply using the .* symbol.
>> a = [1 2 3 4; 5 6 7 8]; b=[2 2 2 2; 3 3 3 3];
>> c=a .* b
c =

2 4 6 8
15 18 21 24

Discussion on matrix "division" using the / symbol for matrices is postponed till later.

Solving systems of linear equations in Matlab

To solve the set of equations
a1 x + b1 y + c1 z = d1
a2 x + b2 y + c2 z = d2
a3 x + b3 y + c3 z = d3

we set this up as a matrix equation of the form
P U = Q
where
P = [a1 b1 c1; a2 b2 c2; a3 b3 c3]
U = [x; y; z]
Q = [d1; d2; d3]

The solution of this system of equations is U = P-1 Q; this is accomplished in Matlab using
>> U = inv(P)*Q

or by using the backslash \ operator
>> U = P\Q

Exercise:

1. Set up Mesh Current Equations in the form R I = V and solve for the mesh currents, I.
2. Set up Node Voltage Equations in the form G V = I and solve for node voltages, V.

Loops

The for loop (very similar to C expression) is a simple command for setting up a loop. Example:

>> for i = 1:10;
>> a(i) = i*i;
>> end
>> a
a =

1 4 9 16 25 36 49 64 81 100

All statements between the for and the end statements will be executed as per the command specifications. Example of a for loop where the increment is not 1 would be >> for i = 1:3:20; ..... etc.
Type in
>> help for
for more details.


Plotting
The plot command is used for generating 1-D (functions of one variable) plots. Do >> help plot for complete details. Let's make a graph of y = sin(x), for x on the interval x=0, to x = 10.
>> x = [0:0.1:10]; (here .1 is the increment)
>> y = sin(x); (notice how the sin function operates on each element of the entire row vector x, to generate a nother row vector y)
>> plot (x, y)

Surface or 2-D (functions of two variables) plots are generated using the surf command. More on that later.

To clear a plot, type in >> clg (clear graph)

To generate another plot window, do >> figure

Printing

You can print a plot using the Print Option under the File Menu in the Figure Window. The text in the Command Window is printed similarly.

File Input/Output

The save and load commands are used for saving data to disk or loading data from disk, respectively.
To save values in a matrix or vector, called, for instance, y, do:
>> y = [1 2 3 4; 5 6 7 8];
>> save y.txt y -ascii
The -ascii option ensures that the data is saved in ASCII form, so that it can be read by other programs - Word, Excel Notepad, Wordpad, etc. Examine the file y.txt using one of these programs. The file is generated in the working directory (remember this? If not click here).

An ASCII data file dat.txt can be loaded using
>> load dat.txt

This provides a variable called dat in the Matlab workspace. All manner of vector/matrix operations can be performed on dat, just like any other variable.

Do >> help save and >>help load for learning all the load/save options.

After you read the next section, click here for a fun Matlab project - generating music with Matlab!

Executable files (m-files in Matlab)

Executable files in Matlab are generated by storing a list of Matlab commands in a file given the extension .m
These files are called M-files. To create an M-file, use the New...M-file Option under the File Menu in the Command Window. Type in the following commands in the M-File Editor Window:
x = [0:0.1:10];
y = cos(x);
plot(x,y)
xlabel('x')
ylabel('y')
title('A plot of Cosine(x)')

Save the file using the Save Option under the File Menu in the M-File Editor Window. Call it, say, cosineplot.m. Now, to run this program in Matlab, move over to the Matlab Command Window and just type in >> cosineplot

Tuesday, August 5, 2008

Mesothelioma: Questions and Answers

Mesothelioma is a rare form of cancer in which malignant (cancerous) cells are found in the mesothelium, a protective sac that covers most of the body's internal organs. Most people who develop mesothelioma have worked on jobs where they inhaled asbestos particles.

1. What is the mesothelium?

The mesothelium is a membrane that covers and protects most of the internal organs of the body. It is composed of two layers of cells: One layer immediately surrounds the organ; the other forms a sac around it. The mesothelium produces a lubricating fluid that is released between these layers, allowing moving organs (such as the beating heart and the expanding and contracting lungs) to glide easily against adjacent structures.

The mesothelium has different names, depending on its location in the body. The peritoneum is the mesothelial tissue that covers most of the organs in the abdominal cavity. The pleura is the membrane that surrounds the lungs and lines the wall of the chest cavity. The pericardium covers and protects the heart. The mesothelial tissue surrounding the male internal reproductive organs is called the tunica vaginalis testis. The tunica serosa uteri covers the internal reproductive organs in women.

2. What is mesothelioma?

Mesothelioma (cancer of the mesothelium) is a disease in which cells of the mesothelium become abnormal and divide without control or order. They can invade and damage nearby tissues and organs. Cancer cells can also metastasize (spread) from their original site to other parts of the body. Most cases of mesothelioma begin in the pleura or peritoneum.

3. How common is mesothelioma?

Although reported incidence rates have increased in the past 20 years, mesothelioma is still a relatively rare cancer. About 2,000 new cases of mesothelioma are diagnosed in the United States each year. Mesothelioma occurs more often in men than in women and risk increases with age, but this disease can appear in either men or women at any age.

4. What are the risk factors for mesothelioma?

Working with asbestos is the major risk factor for mesothelioma. A history of asbestos exposure at work is reported in about 70 percent to 80 percent of all cases. However, mesothelioma has been reported in some individuals without any known exposure to asbestos.

Asbestos is the name of a group of minerals that occur naturally as masses of strong, flexible fibers that can be separated into thin threads and woven. Asbestos has been widely used in many industrial products, including cement, brake linings, roof shingles, flooring products, textiles, and insulation. If tiny asbestos particles float in the air, especially during the manufacturing process, they may be inhaled or swallowed, and can cause serious health problems. In addition to mesothelioma, exposure to asbestos increases the risk of lung cancer, asbestosis (a noncancerous, chronic lung ailment), and other cancers, such as those of the larynx and kidney.

Smoking does not appear to increase the risk of mesothelioma. However, the combination of smoking and asbestos exposure significantly increases a person's risk of developing cancer of the air passageways in the lung.

5. Who is at increased risk for developing mesothelioma?

Asbestos has been mined and used commercially since the late 1800s. Its use greatly increased during World War II. Since the early 1940s, millions of American workers have been exposed to asbestos dust. Initially, the risks associated with asbestos exposure were not known. However, an increased risk of developing mesothelioma was later found among shipyard workers, people who work in asbestos mines and mills, producers of asbestos products, workers in the heating and construction industries, and other tradespeople. Today, the U.S. Occupational Safety and Health Administration (OSHA) sets limits for acceptable levels of asbestos exposure in the workplace. People who work with asbestos wear personal protective equipment to lower their risk of exposure.

The risk of asbestos-related disease increases with heavier exposure to asbestos and longer exposure time. However, some individuals with only brief exposures have developed mesothelioma. On the other hand, not all workers who are heavily exposed develop asbestos-related diseases.

There is some evidence that family members and others living with asbestos workers have an increased risk of developing mesothelioma, and possibly other asbestos-related diseases. This risk may be the result of exposure to asbestos dust brought home on the clothing and hair of asbestos workers. To reduce the chance of exposing family members to asbestos fibers, asbestos workers are usually required to shower and change their clothing before leaving the workplace.

6. What are the symptoms of mesothelioma?

Symptoms of mesothelioma may not appear until 30 to 50 years after exposure to asbestos. Shortness of breath and pain in the chest due to an accumulation of fluid in the pleura are often symptoms of pleural mesothelioma. Symptoms of peritoneal mesothelioma include weight loss and abdominal pain and swelling due to a buildup of fluid in the abdomen. Other symptoms of peritoneal mesothelioma may include bowel obstruction, blood clotting abnormalities, anemia, and fever. If the cancer has spread beyond the mesothelium to other parts of the body, symptoms may include pain, trouble swallowing, or swelling of the neck or face.

These symptoms may be caused by mesothelioma or by other, less serious conditions. It is important to see a doctor about any of these symptoms. Only a doctor can make a diagnosis.

7. How is mesothelioma diagnosed?

Diagnosing mesothelioma is often difficult, because the symptoms are similar to those of a number of other conditions. Diagnosis begins with a review of the patient's medical history, including any history of asbestos exposure. A complete physical examination may be performed, including x-rays of the chest or abdomen and lung function tests. A CT (or CAT) scan or an MRI may also be useful. A CT scan is a series of detailed pictures of areas inside the body created by a computer linked to an x-ray machine. In an MRI, a powerful magnet linked to a computer is used to make detailed pictures of areas inside the body. These pictures are viewed on a monitor and can also be printed.

A biopsy is needed to confirm a diagnosis of mesothelioma. In a biopsy, a surgeon or a medical oncologist (a doctor who specializes in diagnosing and treating cancer) removes a sample of tissue for examination under a microscope by a pathologist. A biopsy may be done in different ways, depending on where the abnormal area is located. If the cancer is in the chest, the doctor may perform a thoracoscopy. In this procedure, the doctor makes a small cut through the chest wall and puts a thin, lighted tube called a thoracoscope into the chest between two ribs. Thoracoscopy allows the doctor to look inside the chest and obtain tissue samples. If the cancer is in the abdomen, the doctor may perform a peritoneoscopy. To obtain tissue for examination, the doctor makes a small opening in the abdomen and inserts a special instrument called a peritoneoscope into the abdominal cavity. If these procedures do not yield enough tissue, more extensive diagnostic surgery may be necessary.

If the diagnosis is mesothelioma, the doctor will want to learn the stage (or extent) of the disease. Staging involves more tests in a careful attempt to find out whether the cancer has spread and, if so, to which parts of the body. Knowing the stage of the disease helps the doctor plan treatment.

Mesothelioma is described as localized if the cancer is found only on the membrane surface where it originated. It is classified as advanced if it has spread beyond the original membrane surface to other parts of the body, such as the lymph nodes, lungs, chest wall, or abdominal organs.

8. How is mesothelioma treated?

Treatment for mesothelioma depends on the location of the cancer, the stage of the disease, and the patient's age and general health. Standard treatment options include surgery, radiation therapy, and chemotherapy. Sometimes, these treatments are combined.

* Surgery is a common treatment for mesothelioma. The doctor may remove part of the lining of the chest or abdomen and some of the tissue around it. For cancer of the pleura (pleural mesothelioma), a lung may be removed in an operation called a pneumonectomy. Sometimes part of the diaphragm, the muscle below the lungs that helps with breathing, is also removed.

* Radiation therapy, also called radiotherapy, involves the use of high-energy rays to kill cancer cells and shrink tumors. Radiation therapy affects the cancer cells only in the treated area. The radiation may come from a machine (external radiation) or from putting materials that produce radiation through thin plastic tubes into the area where the cancer cells are found (internal radiation therapy).

* Chemotherapy is the use of anticancer drugs to kill cancer cells throughout the body. Most drugs used to treat mesothelioma are given by injection into a vein (intravenous, or IV). Doctors are also studying the effectiveness of putting chemotherapy directly into the chest or abdomen (intracavitary chemotherapy).

To relieve symptoms and control pain, the doctor may use a needle or a thin tube to drain fluid that has built up in the chest or abdomen. The procedure for removing fluid from the chest is called thoracentesis. Removal of fluid from the abdomen is called paracentesis. Drugs may be given through a tube in the chest to prevent more fluid from accumulating. Radiation therapy and surgery may also be helpful in relieving symptoms.

9. Are new treatments for mesothelioma being studied?

Yes. Because mesothelioma is very hard to control, the National Cancer Institute (NCI) is sponsoring clinical trials (research studies with people) that are designed to find new treatments and better ways to use current treatments. Before any new treatment can be recommended for general use, doctors conduct clinical trials to find out whether the treatment is safe for patients and effective against the disease. Participation in clinical trials is an important treatment option for many patients with mesothelioma.

Sunday, August 3, 2008

Mesothelioma


Mesothelioma is a form of cancer that is almost always caused by previous exposure to asbestos. In this disease, malignant cells develop in the mesothelium, a protective lining that covers most of the body's internal organs. Its most common site is the pleura (outer lining of the lungs and chest cavity), but it may also occur in the peritoneum (the lining of the abdominal cavity) or the pericardium (a sac that surrounds the heart).

Most people who develop mesothelioma have worked on jobs where they inhaled asbestos particles, or they have been exposed to asbestos dust and fibre in other ways, such as by washing the clothes of a family member who worked with asbestos. Unlike lung cancer, there is no association between mesothelioma and smoking.[1] Compensation via asbestos funds or lawsuits is an important issue in mesothelioma (see asbestos and the law).

The symptoms of mesothelioma include shortness of breath due to pleural effusion (fluid between the lung and the chest wall) or chest wall pain, and general symptoms such as weight loss. The diagnosis can be made with chest X-rays and a CT scan, and confirmed with a biopsy (tissue sample) and microscopic examination. A thoracoscopy (inserting a tube with a camera into the chest) can be used to take biopsies. It allows the introduction of substances such as talc to obliterate the pleural space (called pleurodesis), which prevents more fluid from accumulating and pressing on the lung. Despite treatment with chemotherapy, radiation therapy or sometimes surgery, the disease carries a poor prognosis. Research about screening tests for the early detection of mesothelioma is ongoing.
For more information click here

HOPE
"Hope is the companion of power, and the mother of success; for who so hopes strongly, has within him the gift of miracles." -- Samuel Smiles

This segment begins with more information about malignant mesothelioma, including the causes of the disease and characteristic symptoms. Our comprehensive section on mesothelioma treatment options discusses surgery, chemotherapy, and radiation therapy as well as new types under investigation. We discuss ways to find specialists who treat mesothelioma and some advice on choosing your doctor . The Clinical Trials segment details current clinical studies and links to information specific to those trials.

SUPPORT
"Too often we understimate the power of a touch, a smile, a kind word, a listening ear, an honest compliment, or the smallest act of caring, all of which have the potential to turn a life around." --Dr. Leo Buscaglia

Start planning with Comprehensive Cancer Centers, how to find places to stay near treatment facilities and how to get there in the Travel & Lodging section. Relevant medical journal and mesothelioma news articles are updated regularly. Our SUPPORT segment ends with Survivors & Fighters who have uplifting stories to tell.

HELP

"Knowledge is power."-Francis Bacon

This segment provides Leading Cancer Links. In Your Peace of Mind you’ll find resources to help you and your family feel secure in the weeks, months and years ahead. Here you can find links to information on financial assistance, compensation, and legal options.

NEW: A clinical trial for a lung-sparing combined modality protocol is recruiting mesothelioma patients.

Website Value