Skip to content

Commit

Permalink
session 06 and link to easily find main session site
Browse files Browse the repository at this point in the history
  • Loading branch information
CamachoDejay committed Dec 13, 2017
1 parent 54dbfad commit b6f6694
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 3 deletions.
4 changes: 4 additions & 0 deletions _posts/sessions/2017-10-01-programmingsessions.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ During this session, we will concentrate on how to make MATLAB code easier to re
During this session, we will concentrate on data fitting using one of the minimization algorithms of MATLAB. The function we will work with is called fminsearch, and allows you to find the minimum of an unconstrained multivariable function. We will present an example of its use to fit a sine wave. We will then see some of the problems related to minimization algorithms, in particular the presence of deep local minima where the algorithm gets stuck and cannot get out, thus, never reaching the global minima. After looking at the example we will work together so you fit a Gaussian to a dummy data set.
[Follow this link for detailed information about the session](/session-05)

### [](#S-6)Session 06
During this session, we will concentrate on solving a system of linear equations using the ```mldivide()``` function . We will use it to do some very basic spectral unmixing. Basically, we will decompose a mixed fluorescence spectra (containing 2 known species) into its constituent spectra, and find the relative ratio between the species.
[Follow this link for detailed information about the session](/session-06)

### [](#p1)Project 01

#### Project description
Expand Down
4 changes: 3 additions & 1 deletion _posts/sessions/2017-10-20-session-01.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ And I'm <student's age> years old.
Note that the output consists of two distinct lines. Also please pay attention to the formatting of the number, to say that you are 23.00 years old makes little sense.

## Supporting material
<iframe src="//www.slideshare.net/slideshow/embed_code/key/d5k4BkR0sx3Ezs" width="595" height="485" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe>
<iframe src="//www.slideshare.net/slideshow/embed_code/key/d5k4BkR0sx3Ezs" width="595" height="485" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe>

Link to the presentation from the first session: [Session-01-presentation](/pdfs/Session-01.pdf)

[**Back to main Programming Sessions' site**](/programmingsessions)
4 changes: 3 additions & 1 deletion _posts/sessions/2017-10-27-session-02.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,7 @@ handling``` for inspiration.
3. Finally if you an do the above points then you can also probably change the program in such a way that the number of people in the data set is not decided before hand. You just keep asking for data until the user decides it is enough. For this you will need ***concatenation***

## Supporting material
<iframe src="//www.slideshare.net/slideshow/embed_code/key/K1eFS0YMANsQOn" width="595" height="485" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe>
<iframe src="//www.slideshare.net/slideshow/embed_code/key/K1eFS0YMANsQOn" width="595" height="485" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe>
Link to the presentation from the first session: [Session-02-presentation](/pdfs/Session-02.pdf)

[**Back to main Programming Sessions' site**](/programmingsessions)
4 changes: 3 additions & 1 deletion _posts/sessions/2017-11-15-session-03.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ The task for this session is to go back to [Project01-Step01](/Project01-Step01)

## Supporting material

<iframe src="//www.slideshare.net/slideshow/embed_code/key/aZWJC1vaSesLLo" width="595" height="485" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe>
<iframe src="//www.slideshare.net/slideshow/embed_code/key/aZWJC1vaSesLLo" width="595" height="485" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe>
Link to the presentation: [pdf](/pdfs/Session-03.pdf)

[Link to the code of the third session](https://github.com/CamachoDejay/ProgrammingSessions/tree/master/Session-03)

[**Back to main Programming Sessions' site**](/programmingsessions)
2 changes: 2 additions & 0 deletions _posts/sessions/2017-12-01-session-04.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ The task for this session is to go back to [Project01-Step01](/Project01-Step01)
## Supporting material

[Link to the code of the 4th session](https://github.com/CamachoDejay/ProgrammingSessions/tree/master/Session-04)

[**Back to main Programming Sessions' site**](/programmingsessions)
2 changes: 2 additions & 0 deletions _posts/sessions/2017-12-08-session-05.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ $$
## Supporting material

[Link to the code of the session](https://github.com/CamachoDejay/ProgrammingSessions/tree/master/Session-05)

[**Back to main Programming Sessions' site**](/programmingsessions)
57 changes: 57 additions & 0 deletions _posts/sessions/2017-12-13-session-06.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: "Session 06 - Solving a system of linear equations"
layout: post
date: 2017-12-07 10:00
image: false
headerImage: false
tag:
- Programming Sessions
- Fitting
- Least-squares solution
- System of linear equations
- Spectral unmixing
star: false
category: blog
author: rafa
description: Supporting material for the programming session 05
hidden: true
externalLink: true
---

During this session, we will concentrate on solving a system of linear equations

$$
A*x = y
$$

using the ```mldivide()``` function . We will use it to do some very basic spectral unmixing. Basically, we will decompose a mixed fluorescence spectra (containing 2 known species) into its constituent spectra, and find the relative ratio between the species.

# Solving a system of linear equations in MATLAB

MATLAB has many tools to help you solve a system of linear equations: [see this link](https://mathworks.com/help/matlab/math/systems-of-linear-equations.html). During this session we will concentrate on the function ```mldivide()```. In particular we will see how to handle the case when $$A$$ is a rectangular m-by-n matrix with m not equal to n, and $$y$$ is a matrix with m rows, then ```mldivide(A,y)``` returns a least-squares solution to the system of equations:
$$
A*x = y
$$

## Mix of 2 fluorescence spectra
Let us consider the case of two species, A and B, that are able to fluoresce and have distinct emission spectra: $$S_A$$ and $$S_B$$ . If we were to measure a mix of these two species then we would obtain a total spectra $$S_{tot}$$ which is:

$$
S_{tot} = c_1 S_A + c_2 S_B
$$

Therefore we can use ```mldivide()``` to find $$c_1$$ and $$c_2$$ given a measured spectra $$S_{tot}$$ . We just have to understand that:
1. $$S_{tot}$$ corresponds to our $$y$$ vector with dimensions m-by-1.
2. Matrix A can be built by placing $$S_a$$ and $$S_b$$ as its columns, to obtain a m-by-2 matrix.

Therefore, we just have to do:
```
C = mldivide(A,y)
```
to obtain a 2-by-1 vector C that contains the coefficients $$c_1$$ and $$c_2$$.

## Supporting material

[Link to the code of the session](https://github.com/CamachoDejay/ProgrammingSessions/tree/master/Session-06)

[**Back to main Programming Sessions' site**](/programmingsessions)

0 comments on commit b6f6694

Please sign in to comment.