Skip to content

Commit 961b9a1

Browse files
committed
added matlab chart output
1 parent 6d5d0cc commit 961b9a1

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,9 @@ ylabel('f(x)','FontSize',16);
452452
box on;
453453
```
454454

455-
These commands could be typed individually into the command prompt, or equally saved into a script so that all of the commands can be run together. So plot the cosine of x as well, we can run the following commands:
455+
![Matlab figure 1](https://github.com/csmsoftware/Programming-for-data-analysis-tutorial-Matlab-R-Python/raw/master/img/matlab-figure1.png "Matlab figure 1")
456+
457+
These commands could be typed individually into the command prompt, or equally saved into a script so that all of the commands can be run together. To plot the cosine of x as well, we can run the following commands:
456458

457459
```
458460
% matlab
@@ -461,6 +463,8 @@ hold on;
461463
h2 = plot(x,cos(x),'Color','red','LineStyle','--','LineWidth',2);
462464
```
463465

466+
![Matlab figure 2](https://github.com/csmsoftware/Programming-for-data-analysis-tutorial-Matlab-R-Python/raw/master/img/matlab-figure2.png "Matlab figure 2")
467+
464468
The 'hold' command is required to prevent the plotting of the cosine wave overwriting that of the sine wave. If, instead, you wanted to draw the cosine in a separate graph, then first create a new empty figure.
465469

466470
To include a legend and change the appearance of the axes labels, you could run the following commands. Note that the command 'gca' is asking Matlab to change the current axes (i.e. most recently drawn/clicked in):
@@ -480,6 +484,8 @@ set(gca,'FontSize',14,...
480484
xlim([0 3*pi]);
481485
```
482486

487+
![Matlab figure 3](https://github.com/csmsoftware/Programming-for-data-analysis-tutorial-Matlab-R-Python/raw/master/img/matlab-figure3.png "Matlab figure 3")
488+
483489
Functions take inputs and typically produce outputs, and a simple function is shown below. Note the use of (square) brackets for grouping the output arguments and the parentheses for grouping the input arguments:
484490

485491
```
@@ -711,7 +717,7 @@ R must be installed before RStudio.
711717

712718
RStudio default layout consists of three panels. At left there is a panel showing the code executed plus eventually the textual output. At right, the top panel show the current variables/functions loaded in the environment (top) and the bottom panel allows the access to the file system. When a script is opened the left panel is split in two.
713719

714-
![R Studio](https://github.com/csmsoftware/Programming-for-data-analysis-tutorial-Matlab-R-Python/raw/master/img/rstudio-windows.png "R Studio")
720+
v
715721

716722
### Installing packages
717723

img/matlab-figure1.png

33.4 KB
Loading

img/matlab-figure2.png

30.8 KB
Loading

0 commit comments

Comments
 (0)