diff options
author | Vasil Zlatanov <v@skozl.com> | 2017-03-07 22:05:34 +0000 |
---|---|---|
committer | Vasil Zlatanov <v@skozl.com> | 2017-03-07 22:05:34 +0000 |
commit | 0c48dcd46f871664cba0b970472a21c890736dae (patch) | |
tree | 9a7e060cdd48d49dc514763be5fb5c105b38bfae | |
parent | ead17653f4b783b3cd585616efdd387046517cdd (diff) | |
download | e2-matlab-0c48dcd46f871664cba0b970472a21c890736dae.tar.gz e2-matlab-0c48dcd46f871664cba0b970472a21c890736dae.tar.bz2 e2-matlab-0c48dcd46f871664cba0b970472a21c890736dae.zip |
add report files
29 files changed, 146 insertions, 13 deletions
diff --git a/report/finite/cond1.pdf b/report/finite/cond1.pdf Binary files differnew file mode 100644 index 0000000..733e721 --- /dev/null +++ b/report/finite/cond1.pdf diff --git a/report/finite/cond2a.pdf b/report/finite/cond2a.pdf Binary files differnew file mode 100644 index 0000000..05d9f03 --- /dev/null +++ b/report/finite/cond2a.pdf diff --git a/report/finite/cond2b.pdf b/report/finite/cond2b.pdf Binary files differnew file mode 100644 index 0000000..dcb1c19 --- /dev/null +++ b/report/finite/cond2b.pdf diff --git a/report/finite/cond3.pdf b/report/finite/cond3.pdf Binary files differnew file mode 100644 index 0000000..cbde311 --- /dev/null +++ b/report/finite/cond3.pdf diff --git a/report/finite/cond4.pdf b/report/finite/cond4.pdf Binary files differnew file mode 100644 index 0000000..3e39b1e --- /dev/null +++ b/report/finite/cond4.pdf diff --git a/report/finite/extra1.pdf b/report/finite/extra1.pdf Binary files differnew file mode 100644 index 0000000..033ca95 --- /dev/null +++ b/report/finite/extra1.pdf diff --git a/report/finite/extra2.pdf b/report/finite/extra2.pdf Binary files differnew file mode 100644 index 0000000..6ca6531 --- /dev/null +++ b/report/finite/extra2.pdf diff --git a/report/finite/extra3.pdf b/report/finite/extra3.pdf Binary files differnew file mode 100644 index 0000000..bc4b511 --- /dev/null +++ b/report/finite/extra3.pdf diff --git a/report/finite/instr.pdf b/report/finite/instr.pdf Binary files differnew file mode 100644 index 0000000..c0b44bf --- /dev/null +++ b/report/finite/instr.pdf diff --git a/report/finite/report.pdf b/report/finite/report.pdf Binary files differnew file mode 100644 index 0000000..3175505 --- /dev/null +++ b/report/finite/report.pdf diff --git a/report/finite/test.pdf b/report/finite/test.pdf Binary files differnew file mode 100644 index 0000000..77f97db --- /dev/null +++ b/report/finite/test.pdf diff --git a/report/instructions.md b/report/instructions.md new file mode 100644 index 0000000..7fe7f7e --- /dev/null +++ b/report/instructions.md @@ -0,0 +1,13 @@ +## Email 1 +There have been a lot of questions about the format/content of the report. This should include: + +1) All the code, well commented/explained. That means explain how the algorithm works and how it solves the given ODE/PDE, or how error the analysis is carried out and what it means. + +2) All plots, with brief comments explaining the physical significance of the solutions in the plots, e.g. things like resonance, transient/steady-state, corner frequency. In Q1-3, that is in the context of the circuit. In Q4 you may use the idea of heat distribution in a rod. + +Above all, you should write as if for one of your peers: your audience is someone with your level of knowledge of Mathematics and Circuits, but who doesn't know this particular topic, and you are explaining it to them. + +This report is what you submit as paper copy on 13 March by 4pm. On Blackboard there will be a link to submit the report and, separately, the program files, before 22:00 on 13 March. Please do not submit zip-files: each file report.pdf and code.m needs to be submitted. One team member to submit on behalf of group. Please include group number in the filename. + +## Email 2 +You should aim to explain your results to someone at your level of Mathematical maturity: your audience is your peers. Don't repeat what I did in lectures, but make sure you explain what YOU did: in the code, the figures, etc. You should explain the behaviour of the solutions in terms of the behaviour of the underlying circuits. Above all, the report should be easy to read: put the plots where they belong: in the text where you first discuss them. diff --git a/report/raltson/ex1_part1_step_input.pdf b/report/raltson/ex1_part1_step_input.pdf Binary files differnew file mode 100644 index 0000000..b345d9a --- /dev/null +++ b/report/raltson/ex1_part1_step_input.pdf diff --git a/report/raltson/ex1_part2_a.pdf b/report/raltson/ex1_part2_a.pdf Binary files differnew file mode 100644 index 0000000..005e45e --- /dev/null +++ b/report/raltson/ex1_part2_a.pdf diff --git a/report/raltson/ex1_part2_b.pdf b/report/raltson/ex1_part2_b.pdf Binary files differnew file mode 100644 index 0000000..f2d3a62 --- /dev/null +++ b/report/raltson/ex1_part2_b.pdf diff --git a/report/raltson/ex1_part3_1000us_sawtooth.pdf b/report/raltson/ex1_part3_1000us_sawtooth.pdf Binary files differnew file mode 100644 index 0000000..1de5683 --- /dev/null +++ b/report/raltson/ex1_part3_1000us_sawtooth.pdf diff --git a/report/raltson/ex1_part3_1000us_sine.pdf b/report/raltson/ex1_part3_1000us_sine.pdf Binary files differnew file mode 100644 index 0000000..24407ae --- /dev/null +++ b/report/raltson/ex1_part3_1000us_sine.pdf diff --git a/report/raltson/ex1_part3_1000us_square.pdf b/report/raltson/ex1_part3_1000us_square.pdf Binary files differnew file mode 100644 index 0000000..9fe82e6 --- /dev/null +++ b/report/raltson/ex1_part3_1000us_square.pdf diff --git a/report/raltson/ex1_part3_160us_sawtooth.pdf b/report/raltson/ex1_part3_160us_sawtooth.pdf Binary files differnew file mode 100644 index 0000000..abae608 --- /dev/null +++ b/report/raltson/ex1_part3_160us_sawtooth.pdf diff --git a/report/raltson/ex1_part3_160us_sine.pdf b/report/raltson/ex1_part3_160us_sine.pdf Binary files differnew file mode 100644 index 0000000..212e606 --- /dev/null +++ b/report/raltson/ex1_part3_160us_sine.pdf diff --git a/report/raltson/ex1_part3_160us_square.pdf b/report/raltson/ex1_part3_160us_square.pdf Binary files differnew file mode 100644 index 0000000..bf6d4aa --- /dev/null +++ b/report/raltson/ex1_part3_160us_square.pdf diff --git a/report/raltson/ex1_part3_20us_sawtooth.pdf b/report/raltson/ex1_part3_20us_sawtooth.pdf Binary files differnew file mode 100644 index 0000000..472340a --- /dev/null +++ b/report/raltson/ex1_part3_20us_sawtooth.pdf diff --git a/report/raltson/ex1_part3_20us_sine.pdf b/report/raltson/ex1_part3_20us_sine.pdf Binary files differnew file mode 100644 index 0000000..d3e9726 --- /dev/null +++ b/report/raltson/ex1_part3_20us_sine.pdf diff --git a/report/raltson/ex1_part3_20us_square.pdf b/report/raltson/ex1_part3_20us_square.pdf Binary files differnew file mode 100644 index 0000000..a37e3ed --- /dev/null +++ b/report/raltson/ex1_part3_20us_square.pdf diff --git a/report/raltson/ex1_part3_450us_sawtooth.pdf b/report/raltson/ex1_part3_450us_sawtooth.pdf Binary files differnew file mode 100644 index 0000000..522f33c --- /dev/null +++ b/report/raltson/ex1_part3_450us_sawtooth.pdf diff --git a/report/raltson/ex1_part3_450us_sine.pdf b/report/raltson/ex1_part3_450us_sine.pdf Binary files differnew file mode 100644 index 0000000..58134d0 --- /dev/null +++ b/report/raltson/ex1_part3_450us_sine.pdf diff --git a/report/raltson/ex1_part3_450us_square.pdf b/report/raltson/ex1_part3_450us_square.pdf Binary files differnew file mode 100644 index 0000000..be4a6e4 --- /dev/null +++ b/report/raltson/ex1_part3_450us_square.pdf diff --git a/report/report.md b/report/report.md index acf4982..aa7b1e6 100644 --- a/report/report.md +++ b/report/report.md @@ -1,27 +1,147 @@ % Numerical Analysis -% Vasil Zlatanov -% Imperial College 2017 +% Group 10: Forbelets +% Imperial College, March 2017 -# RL circuit -## Raltson method -Show the different graphs. +## Grahps Benedikt -## Error Analysis -Compare to exact solution. +![mytitle \label{mylabel}](raltson/ex1_part1_step_input.pdf){width=80%} -# RLC circuit +![mytitle \label{mylabel}](raltson/ex1_part2_a.pdf){width=80%} -## RK 3/8 Method -Show the graph +![mytitle \label{mylabel}](raltson/ex1_part2_b.pdf){width=80%} + +![mytitle \label{mylabel}](raltson/ex1_part3_1000us_sawtooth.pdf){width=80%} + +![mytitle \label{mylabel}](raltson/ex1_part3_1000us_sine.pdf){width=80%} + +![mytitle \label{mylabel}](raltson/ex1_part3_1000us_square.pdf){width=80%} + +![mytitle \label{mylabel}](raltson/ex1_part3_160us_sawtooth.pdf){width=80%} + +![mytitle \label{mylabel}](raltson/ex1_part3_160us_sine.pdf){width=80%} + +![mytitle \label{mylabel}](raltson/ex1_part3_160us_square.pdf){width=80%} + +![mytitle \label{mylabel}](raltson/ex1_part3_20us_sawtooth.pdf){width=80%} + +![mytitle \label{mylabel}](raltson/ex1_part3_20us_sine.pdf){width=80%} + +![mytitle \label{mylabel}](raltson/ex1_part3_20us_square.pdf){width=80%} + +![mytitle \label{mylabel}](raltson/ex1_part3_450us_sawtooth.pdf){width=80%} + +![mytitle \label{mylabel}](raltson/ex1_part3_450us_sine.pdf){width=80%} + +![mytitle \label{mylabel}](raltson/ex1_part3_450us_square.pdf){width=80%} + # Finite Differences for PDE -## Finite difference method +## Comments on implementation: + +We first create a matrix to implement our finite difference method on. The two dimensions of the matrix and time and displacement. + +The first row of the matrix (in other words at time t = 0) is populated with the initial conditions. + +The rest of the matrix is populated in a loop from the initial conditions and the boundary conditions. + +In the loop, for each value of m, the time iterate of the matrix, we set the first and last possible displacement index's to our desired boundary conditions. We then we iterate trough each displacement step and apply the central algorithm to it. The full implementation of this loop can be seen in the included code in ex4.m. + +$$ U_{j}^{m+1} = v U_{j-1}^{m} + (1-2v) U^m_j + v U^{m}_{j+1} $$ +$$ = U^m_j + v ( U_{j}^{m+1} - 2 U^m_j + U^{m}_{j+1}) $$ + +Where $$ v=\frac{k}{h^2} $$ + +Writing this in matlab as a two dimensional matrix is very similar. + +```matlab +u(m+1,j) = u(m,j) + ((k/(h^2))*(u(m,j+1) - 2*u(m,j) + u(m,j-1))); +``` + +Physicaly this means that if that if the sum of the temperature of the two adjacent points is higher is higher than two times the temperature of the given point, the temperature of the selected point will go up after one time step, while if the two adjacent points sum up to less than twice our current temperature, our next temperature will decrease. + +As time tends to infinity the temperature will tend towards the boundary conditions as they will set the temperature of their neghbours which will propagate trough the curve. + +## Choosing h and k + +Choosing h (the displacement step) and the appropirate k (time step) is not a trivial task. Picking a very small time step is computationally expensive (requires a big matrix and a computer with more memory), and we generally want to compare the temperature distribution at larger time increments (as shown in the instruction sheet). + +The Von Neumann stability anlaysis shows that in order to produce a stable results it is required: + +$$ \frac{k}{h^2} \leq \frac{1}{2} $$ -Show graphs +Since we want to produce long simulations with a small distance step, but don't want to see extremely small steps in the graph, we set the time step to satisfy the equality given a value for h. Even then, the steps are hardly small so when graphing we only a fraction of the time steps from the whole range. In our implementation we print 10 equaliy spaced lines from the time range. + +### Tent Function + +$$ +y_0(x) = +\left\{ + \begin{array}{ll} + 2x & \mbox{for } x \in [0,0.5] \\ + 2-2x & \mbox{for } x \in [0.5,1] + \end{array} +\right. +$$ + +![Tent Function\label{tent}](finite/cond1.pdf){width=80%} + +In figure \ref{tent} we can see the tent function applied as the initial condition to a one dimensional rod of length 1. The coloured lines represent the approximated temperature at times increments of 0.1, all the way up to 1.0. Because of the boundary conditions the end points are bound to zero degrees and as a result the temperature of the rod decreases. As **t** approaches infinity the temperate of the rod will approach zero, where the center point which started as the highest temperature and is furthest away from the boundaries maintains the highest temperature of all points. + + +### Sinusoidal Function + +$$ y_0(x) = \sin{2\pi x} $$ + +![Sinusoidal Function A\label{sina}](finite/cond2a.pdf){width=80%} + +In figure \ref{sina} we perform the finite difference method on to a sinusoid. The result yet again is decreasing temperature as the boundaries are zero. The temperature decreases such that the resulting distribution continues to be sinusoidal, only with a different amplitude. The left and right side fo the rod have identical but opposite amplitudes, and due to this equilibrium the center point at 0.5 displacement stays at 0 temperature. + + +$$ y_0(x) = |\sin{2\pi x}| $$ + +![Sinusoidal Function B\label{sinb}](finite/cond2b.pdf){width=80%} + +In figure \ref{sinb} we use the same initial condition function, only this time we take the absolute value of it so what was negative before is now positive. It is interesting to note that the resulting distribution at $t \neq 0$ is very different from the absolute value of that in figure \ref{sinb}. Point 0.5 no longer sits at 0 and is instead heated due to neighboring elements until it becomes the hottest point. + +### Square Function + +$$ +y_0(x) = +\left\{ + \begin{array}{ll} + 0 & \mbox{for } x \in [0,0.25] \cup [0.75,1] \\ + 1 & \mbox{for } x \in [0.25,0.75] + \end{array} +\right. +$$ + + +![Square Function\label{square}](finite/cond3.pdf){width=80%} + +Applying the "square" function in figure \ref{square} produces interesting results. Where as in figure \ref{sinb} the center heated up while the corners cooled down the opposite happens initially, as the curve straightens out. This happens because of the extreme temperature difference that we introduced. + +### Double Tent function + +![Double Tent\label{dtent}](finite/cond4.pdf){width=80%} + +Making two symmetric tent functions with oposite signs like in figure \ref{dtent},shows a result like that in figure \ref{tent}, with an artificial boundary of zero in the centre due to the symmetry. ## Varying boundary conditions +![Non-matching initial and boundary conditions\label{extra1}](finite/extra1.pdf){width=80%} + +It is possible to give the algorithm an initial condition which does not match the boundary conditions. In figure \ref{extra1} we can see the initial conditions in blue which attempt to set the corners of the rod to -1 and 1 respectively. As the boundaries are forced to to zero they quickly pull the graph away from the original initial conditions and towards themselves. As **t** approaches infinity \ref{extra1} will become a straight line between the two boundaries. Again we have an equilibrium and a constant temperature of zero in the middle. + +### Non Zero boundary conditions + +![Non Zero Boundary Conditions\label{extra2}](finite/extra2.pdf){width=80%} + +In \ref{extra2} we use the same initial conditions as in figure \ref{sina}, however this time we set the boundary conditions to be 0.5 and 1. Yet again this forces the temperature curve towards them. The equilibrium at 0.5 displacement is no longer maintained as as the boundaries are different and non-zero. As **t** approaches infinity we will get a straight line between 0.5 and 1 temperature. + +### Time varying boundary conditions + +![Varying Boundary Conditions\label{extra3}](finite/extra3.pdf){width=80%} -Show the graphs +Finally in every loop itteration we can change the boundary condition based on the elapsed time. We can see the effect of doing so on the original tent function in figure \ref{extra3}. The boundaries move from 0 degrees to 0.5 degrees at a rate of 5 degrees per second. The result is the function bending back on itself as the boundaries start moving up. diff --git a/report/report.pdf b/report/report.pdf Binary files differnew file mode 100644 index 0000000..0e1651e --- /dev/null +++ b/report/report.pdf |