Documentation

## Creating 2-D Plots

This example shows how to create 2-D line plots in MATLAB using the plot function.

Create a regularly-spaced vector x from 0 to 2*pi using pi/100 as the increment between elements.

```x = 0:pi/100:2*pi; ```

Calculate sine for each value in x.

```y = sin(x); ```

Use the figure command to create a new figure and plot command to display result.

```figure; plot(x, y) ``` Label the axes and add a title so that viewers understand the purpose of your graph.

```xlabel('x') ylabel('sin(x)') title('Plot of the Sine Function') ``` You can plot the same variables with specified line style, color, and marker (A marker is a symbol that appears at each plotted data point, such as a +, o, or *). Use 'help plot' to learn more about line specification.

In this example, the 'r--' string is a red dashed-line specification.

```figure plot(x, y, 'r--') title('Plot of the Sine Function (Red Dashed-line)') ``` To add plots to an existing figure, use hold.

```figure plot(x, y) hold on y2 = cos(x); plot(x, y2, ':') legend('sin', 'cos') title('Plot of Sine and Cosine Functions') ``` Use 'hold off' to stop plotting on top of the existing figure.

```hold off ```
{"ft_lang_label":"__label__en","ft_lang_prob":0.74610454,"math_prob":0.953757,"size":1102,"snap":"2019-35-2019-39","text_gpt3_token_len":286,"char_repetition_ratio":0.114754096,"word_repetition_ratio":0.0,"special_character_ratio":0.27586207,"punctuation_ratio":0.12704918,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9995875,"pos_list":[0,1,2,3,4,5,6,7,8],"im_url_duplicate_count":[null,1,null,1,null,1,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-09-16T17:03:09Z\",\"WARC-Record-ID\":\"<urn:uuid:52aa18f9-6c37-42d4-ab3a-77efcee39d63>\",\"Content-Length\":\"64256\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:e6eb481b-0524-471b-95fa-a0e59faf1648>\",\"WARC-Concurrent-To\":\"<urn:uuid:d3b8bb43-02f0-45e1-adcb-d4f8f8467539>\",\"WARC-IP-Address\":\"23.48.45.75\",\"WARC-Target-URI\":\"https://fr.mathworks.com/help/matlabmobile_android/ug/creating-2d-plots.html\",\"WARC-Payload-Digest\":\"sha1:XUKVVCCQPM47GNNTZCIN2KZOYMHDMP3D\",\"WARC-Block-Digest\":\"sha1:WR4WEUUNI3JAUGIVP5XHJVTQLOZNR5CH\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-39/CC-MAIN-2019-39_segments_1568514572879.28_warc_CC-MAIN-20190916155946-20190916181946-00245.warc.gz\"}"}