diff options
author | Vasil Zlatanov <v@skozl.com> | 2017-03-06 18:37:51 +0000 |
---|---|---|
committer | Vasil Zlatanov <v@skozl.com> | 2017-03-06 18:37:51 +0000 |
commit | b62bc27fcd6450ac4a1b056c833a5f81cb09b472 (patch) | |
tree | c0bb674a141f9baea03c4d710617d42325fca994 /coursework17 | |
parent | 86466678b35deb496f6fd5ad08e527412290b3d3 (diff) | |
download | e2-matlab-b62bc27fcd6450ac4a1b056c833a5f81cb09b472.tar.gz e2-matlab-b62bc27fcd6450ac4a1b056c833a5f81cb09b472.tar.bz2 e2-matlab-b62bc27fcd6450ac4a1b056c833a5f81cb09b472.zip |
implement legend and labels
Diffstat (limited to 'coursework17')
-rw-r--r-- | coursework17/ex4.m | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/coursework17/ex4.m b/coursework17/ex4.m index 6f44271..7e2175a 100644 --- a/coursework17/ex4.m +++ b/coursework17/ex4.m @@ -3,6 +3,8 @@ % h = dx % k = dt +clear + dx = input('Input position step (for example 0.01): '); % play about with this to get resolution % Calulate maximum dt to maintain stability, based on the tailor expansion. @@ -12,8 +14,6 @@ tfin = input('Input the time you wawnt to end the simulation (for example 0.1): lines = input('How many lines across the time range would you like to plot (for example 10): '); -% v = dx/(dt^2); %redundant - % Create x and t for plotting in the array x = 0:dx:1; t = 1:dt:tfin+1; @@ -70,6 +70,12 @@ end figure; hold on; +j = 0 for i = 1:round(length(t)/lines):length(t) + j = j+1; plot(x,u(i,:),'.'); + legendInfo{j} = ['t = ' num2str(round(i*dt, 3))]; end +legend(legendInfo); +xlabel('Displacement'); +ylabel('Temperature'); |