<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="Student_Book_Matlab3_files/pmathml.xml" type="text/xsl"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd">
<!--        This document was created  with

            S O F T 4 S C I E N C E      S c i W r i t e r   

            http://www.soft4science.com     e-mail: info@soft4science.com
-->
<html pref:renderer="mathplayer-dl" xmlns:pref="http://www.w3.org/2002/Math/preference" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="Generator" content="soft4science SciWriter"/>
    <meta name="Style-ParagraphMargins" content="&lt;ParagraphMargins p_bottom=&quot;1&quot; p_top=&quot;1&quot; /&gt;"/>
    <meta name="Style-Headings" content="&lt;Headings fontSize_H2=&quot;140&quot; /&gt;"/>
    <meta name="Style-GeneralText" content="&lt;GeneralText textIndent=&quot;0&quot; /&gt;"/>
    <meta name="PreferedMathMLRenderer" content="mathplayer_dl"/>
    <meta name="template" content="X_Times.tpl"/>
    <meta name="guid" content="76f522a1-606c-4029-a49b-0c23f9b8f2f3"/>
    <meta name="date_lastUpdated" content="2008-05-21T16:20:01"/>
    <meta name="date_created" content="2008-04-03T11:45:15"/>
    <meta name="SciWriter-Options" content="&lt;SciWriterOptions TextWidth=&quot;943&quot; ShowRuler=&quot;True&quot; /&gt;"/>
    <meta name="SciWriter-Version" content="3.0.2.0"/>
    <title>unknown</title>
    <style type="text/css"><![CDATA[
    /* - CSS code generated by soft4science SciWriter  -*/

    body{font-size:14.25pt}
    table{font-size:14.25pt}
    a:link,a:active,a:visited{color:blue}
    img{border-width:0px}
    p,li,td,caption, blockquote{font-family:"Times New Roman",times}
    p{text-indent:0em}
    h1,h2,h3,h4,h5,h6{font-family:"Times New Roman",times;color:#4682B4}
    p{margin-top:1em;margin-bottom:1em}
    li{margin-top:1em;margin-bottom:1em}
    h1{font-size:160%;margin-top:1.5em;margin-bottom:1.5em}
    h2{font-size:140%;margin-top:1.5em;margin-bottom:1.5em}
    h3{font-size:140%;margin-top:1.5em;margin-bottom:1.5em}
    h4{font-size:130%;margin-top:1.5em;margin-bottom:1.5em}
    h5{font-size:120%;margin-top:1.5em;margin-bottom:1.5em}
    h6{font-size:110%;margin-top:1.5em;margin-bottom:1.5em}
    table{margin-top:1em;margin-bottom:1em}
    pre{margin-top:1em;margin-bottom:1em}
    hr{margin-top:1em;margin-bottom:1em}
    ul,ol{margin-top:0em;margin-bottom:0em}

    math          {font-family:"Times New Roman",times,CMSY10, CMEX10, Symbol}
    mml\:math    {font-family:"Times New Roman",times,CMSY10, CMEX10, Symbol}
    math[display="block"]{display:block;text-align:center;font-style: normal;}
    math *.[mathvariant="normal"] {font-weight: normal;font-style: normal;}
    math *.[mathvariant="bold"]   {font-weight: bold;font-style: normal;}
    math *.[mathvariant="italic"] {font-weight: normal;font-style: italic;}
    math *.[mathvariant="bold-italic"] {font-weight: bold;font-style: italic;}
    math *.[mathvariant="double-struck"]{font-family:msbm;font-weight: normal;font-style: normal;}
    math *.[mathvariant="script"]{font-family: eusb;font-weight: normal;font-style: normal;}
    math *.[mathvariant="bold-script"]{font-family: eusb;font-weight: bold;font-style: normal;}
    math *.[mathvariant="fraktur"] {font-family: eufm;font-weight: normal;font-style: normal;}
    math *.[mathvariant="bold-fraktur"] {font-family: eufm;font-weight: bold;font-style: italic;}
    math *.[mathvariant="sans-serif}"] {font-family: sans-serif,Arial,Lucida Sans Unicode, Verdana;font-weight: normal;font-style: normal;}
    math *.[mathvariant="bold-sans-serif"] {font-family: sans-serif,Arial, Lucida Sans Unicode, Verdana;font-weight: bold;font-style: normal;}
    math *.[mathvariant="sans-serif-italic"]{font-family: sans-serif,Arial, Lucida Sans Unicode, Verdana;font-weight: normal;font-style: italic;}
    math *.[mathvariant="sans-serif-bold-italic"] { font-family: sans-serif,Arial, Lucida Sans Unicode, Verdana ;font-weight: bold;font-style: italic;}
    math *.[mathvariant="monospace"] {font-family: monospace};
    math *.[mathsize="small"] {font-size: 80%};
    math *.[mathsize="big"] {font-size: 125%};
    msub>*:first-child[mathsize="big"],msup>*:first-child[mathsize="big"],msubsup>*:first-child[mathsize="big"],munder>*:first-child[mathsize="big"],mover>*:first-child[mathsize="big"],munderover>*:first-child[mathsize="big"],mmultiscripts>*:first-child[mathsize="big"],mroot>*:first-child[mathsize="big"] {font-size: 125%}
    msub>*:first-child[mathsize="small"],msup>*:first-child[mathsize="small"],msubsup>*:first-child[mathsize="small"],munder>*:first-child[mathsize="small"],mover>*:first-child[mathsize="small"],munderover>*:first-child[mathsize="small"],mmultiscripts>*:first-child[mathsize="small"],mroot>*:first-child[mathsize="small"] {  font-size: 80%}
    msub>*:first-child,msup>*:first-child,msubsup>*:first-child,munder>*:first-child,mover>*:first-child,munderover>*:first-child,mmultiscripts>*:first-child,mroot>*:first-child {  font-size: 100%}
    msub>*[mathsize="big"],msup>*[mathsize="big"],msubsup>*[mathsize="big"],munder>*[mathsize="big"],mover>*[mathsize="big"],munderover>*[mathsize="big"],mmultiscripts>*[mathsize="big"],math[display="inline"] mfrac>*[mathsize="big"],math *[scriptlevel="+1"][mathsize="big"] {  font-size: 89%  /* (.71 times 1.25) */}
    msub>* [mathsize="small"],msup>*[mathsize="small"],msubsup>*[mathsize="small"],munder>*[mathsize="small"],mover>*[mathsize="small"],munderover>*[mathsize="small"],mmultiscripts>*[mathsize="small"],math[display="inline"] mfrac>*[mathsize="small"],math *[scriptlevel="+1"][mathsize="small"] {  font-size: 57% /* (.71 times .80) */}
    msub>*,msup>*,msubsup>*,munder>*,mover>*,munderover>*,mmultiscripts>*,math[display="inline"] mfrac>*,math *[scriptlevel="+1"] {  font-size: 71%}
    mroot>*[mathsize="big"] {  font-size: 62%  /* (.50 times 1.25) */}
    mroot>*[mathsize="small"] {  font-size: 40% /* (.50 times .80) */}
    mroot>* {  font-size: 50%}
    .s4s-table-right{text-align:right}
    .s4s-table-right table{margin-left:auto;margin-right:0;text-align:left;}
    .s4s-table-right caption{margin-left:auto;margin-right:auto;text-align:center;}
    .s4s-table-center{text-align:center;}
    .s4s-table-center table{margin-left:auto;margin-right:auto;text-align:left;}
    .s4s-table-center caption{margin-left:auto;margin-right:auto;text-align:center;}
    .s4s-empty-paragraph{height:1em;width:textwidth}
    .s4s-noindent{text-indent:0em}
    .s4s-citation          {text-decoration:none}
    .s4s-footnote          {text-decoration:none;position:relative;top:-0.2em;font-size:0.9em}
    .s4s-section-reference {text-decoration:none}
    .s4s-theorem-reference {text-decoration:none}
    .s4s-table-reference   {text-decoration:none}
    .s4s-figure-reference  {text-decoration:none}
    .s4s-equation-reference{text-decoration:none}
    .s4s-latex             {visibility:hidden;line-height:0em;height:0em;width:0em;display:none}

    /* - CSS code generated by soft4science SciWriter  -*/
]]></style>
  </head>
  <body style="margin: 50px;">
    <table class="s4s-figure">
      <tbody>
        <tr>
          <td align="center">
            <img alt="log7" src="Student_Book_Matlab3_files/log7.gif"/>
          </td>
        </tr>
      </tbody>
    </table>
    <p style="text-align: center;" class="s4s-noindent">
      <span style="font-size: 200%;">
        <strong>Надписи към графики в MATLAB</strong>
      </span>
    </p>
    <h1 class="s4s-section-numbered" id="SECTION.7d74decf-7ea1-4672-ae85-4cc61e87f29c">
      <span class="s4s-section-number">1  </span>Основни надписи </h1>
    <p class="s4s-noindent">Вече знаем как се рисуват графики с помощта на командата на MATLAB <span style="font-family: Tahoma;">"plot" </span>, която извежда резултат от типа на следния </p>
    <p class="s4s-empty-paragraph"> </p>
    <div class="s4s-table-center">
      <table class="s4s-figure">
        <tbody>
          <tr>
            <td align="center">
              <img alt="MATLAB5" src="Student_Book_Matlab3_files/MATLAB5.jpg"/>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <p class="s4s-noindent">или с помощта на следните команди:</p>
    <p>
      <span style="font-family: Tahoma;">x=linspace(-2*pi,2*pi,500);</span>
    </p>
    <p>
      <span style="font-family: Tahoma;">y=sin(x);</span>
    </p>
    <p>
      <span style="font-family: Tahoma;">plot(x,y)</span>
    </p>
    <p>
      <span style="font-family: Tahoma;">axis tight</span>
    </p>
    <p>Макар че ние знаем, че това е графика на функцията синус, освен размерностите по x и y нямаме изведена друга информация на екрана. Ще покажем как се добавят други надписи като означения на координатните оси и заглавие. Въвеждайки </p>
    <p>
      <span style="font-family: Tahoma;">xlabel(</span>
      <span style="color: Purple; font-family: Tahoma;">'time (s)'</span>
      <span style="font-family: Tahoma;">)</span>
    </p>
    <p>
      <span style="font-family: Tahoma;">ylabel(</span>
      <span style="color: Purple; font-family: Tahoma;">'amplitude (mm)'</span>
      <span style="font-family: Tahoma;">)</span>
    </p>
    <p>
      <span style="font-family: Tahoma;">title(</span>
      <span style="color: Purple; font-family: Tahoma;">'Plot of sine wave over time period -2\pi \leq t \leq 2\pi'</span>
      <span style="font-family: Tahoma;">)</span>
    </p>
    <p>ще получим следната графика: </p>
    <div class="s4s-table-center">
      <table class="s4s-figure">
        <tbody>
          <tr>
            <td align="center">
              <img alt="MATLAB6" src="Student_Book_Matlab3_files/MATLAB62.JPG"/>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <table class="s4s-figure">
      <tbody>
        <tr>
          <td>Обърнете внимание, че исканият текст се загражда със символа апостроф (<span style="color: Purple;">'</span>). MATLAB променя цвета в кафяво, за да означи, че е въведен първият апостроф и в пурпурно, за да означи втория въведен апостроф. Ако лисва вторият апостроф, командта изглежда така</td>
        </tr>
      </tbody>
    </table>
    <p class="s4s-noindent">
      <span style="font-family: Tahoma;">xlabel(</span>
      <span style="color: rgb(128, 64, 0); font-family: Tahoma;">'time (s)</span>
      <span style="font-family: Tahoma;">)</span>
    </p>
    <p>и ако натиснем Еnter, ще получим съобщение за грешка:</p>
    <p>
      <span style="color: Red; font-family: Tahoma;">??? xlabel('time (s))</span>
    </p>
    <p>
      <span style="color: Red; font-family: Tahoma;">Error: A MATLAB string constant is not terminated properly</span>
    </p>
    <p>В горния пример, заглавието съдържа символа t записан в код на LaTeX. MATLAB преобразува всеки текст, записан като LaTeX в съответния символ, след което го поставя в текстовия стринг. Това дава възможност в текста да се показват символи, които липсват на стандарната клавиатура.  </p>
    <h1 class="s4s-section-numbered" id="SECTION.a12a1374-7d9b-490f-a7e2-8ae851b3bb7c">
      <span class="s4s-section-number">2  </span>Множество от графики</h1>
    <p class="s4s-noindent">Много лесно се чертаят две и повече графики в една фигура. Кликнете с ляв бутон на мишката върху желаната фигура. В командния ред въведете </p>
    <p>
      <span style="font-family: Tahoma;">hold on</span>
    </p>
    <p>
      <span style="font-family: Tahoma;">y1=sin(2*x);</span>
    </p>
    <p>
      <span style="font-family: Tahoma;">plot(x,y1,'r')</span>
    </p>
    <p>
      <span style="font-family: Tahoma;">title(</span>
      <span style="color: Purple; font-family: Tahoma;">'Plot of sine waves over time period -2\pi \leq t \leq 2\pi'</span>
      <span style="font-family: Tahoma;">)</span>
    </p>
    <p>Символът <span style="font-family: Tahoma;">'r' </span>е вмъкнат, за да се оцвети съответната крива в червен цвят. Последната команда се създава лесно чрез натискане на клавиша <math xmlns="http://www.w3.org/1998/Math/MathML"><mo>↑</mo><mspace width="mediummathspace" height="0.2em"/></math> няколко пъти до първичната команда</p>
    <p>
      <span style="font-family: Tahoma;">title(</span>
      <span style="color: Purple; font-family: Tahoma;">'Plot of sine wave over time period -2\pi \leq t \leq 2\pi'</span>
      <span style="font-family: Tahoma;">)</span>
    </p>
    <p>като кликнем отляво на "<span style="color: Purple; font-family: Tahoma;">wave</span>" и допишем буквата "<span style="color: Purple; font-family: Tahoma;">s</span>".</p>
    <p>Друг начин освен използването на командата <span style="font-family: Tahoma;">"hold on" </span>е да запишем многото графики директно във функцията на командата <span style="font-family: Tahoma;">"plot"</span>, например </p>
    <p>
      <span style="font-family: Tahoma;">plot(x,y,'b',x,y1,'r')</span>
    </p>
    <p>
      <span style="font-family: Tahoma;">axis tight</span>
    </p>
    <div class="s4s-table-center">
      <table class="s4s-figure">
        <tbody>
          <tr>
            <td align="center">
              <img alt="MATLAB7" src="Student_Book_Matlab3_files/MATLAB71.JPG"/>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <p class="s4s-empty-paragraph"/>
    <p>Можем да добавяме и легенди с помощта на следната команда </p>
    <p>
      <span style="font-family: Tahoma;">legend( </span>
      <span style="color: Purple; font-family: Tahoma;">'sin(x)', 'sin(2x)' </span>
      <span style="font-family: Tahoma;">)</span>
    </p>
    <p>Тя ще произведе следната графика, която включва легендата в горния десен ъгъл. </p>
    <div class="s4s-table-center">
      <table class="s4s-figure">
        <tbody>
          <tr>
            <td align="center">
              <img alt="MATLAB8" src="Student_Book_Matlab3_files/MATLAB81.JPG"/>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <p class="s4s-noindent">По подразбиране легендата се поставя в горния десен ъгъл, както е показано по-горе, но тя после може да се премести където и да е в графиката, като се избере с ляв бутон на мишката и се изтегли на желаното място. Също така може да се вмъкнат цифрите 2, 3 или 4 в самата команда, например, </p>
    <p>
      <span style="font-family: Tahoma;">legend( </span>
      <span style="color: Purple; font-family: Tahoma;">'sin(x)', 'sin(2x)' </span>
      <span style="font-family: Tahoma;">, 2)</span>
    </p>
    <p>за да се смени позицията на горен ляв ъгъл, долен ляв ъгъл или долен десен ъгъл, съответно. Графиката може да се запише или в MATLAB като .fig файл, или да се експортира в повечето стандартни графични формати с "file - save as". Така практически е възможно използването на фигури, създадени с MATLAB във всеки документен формат. </p>
    <h1 class="s4s-section-numbered" id="SECTION.74bfd06d-8eea-4c70-8ba5-a4950d66b00e">
      <span class="s4s-section-number">3  </span>Подграфики</h1>
    <p class="s4s-noindent">Понякога е удобно да се създават и подграфики в една фигура, например за сравнения между тях. </p>
  </body>
</html>