02.03.2016 Views

MATLAB by rudra pratap

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

130 Programming in <strong>MATLAB</strong>: Scripts and Functions<br />

Note that the mathematical expression is enclosed within the double dollar<br />

signs and starts with a % sign. The equation must be preceded <strong>by</strong> a cell<br />

marker (%%). The TeX Equation cell introduced earlier results in the following<br />

equation (\quad introduces some blank space):<br />

If you do not know L\\.TE;X, see Table 4.1, which shows an introductory list of<br />

L\\.TE;X commands used in mathematical expressions. These L\\.TE;X commands<br />

arc also useful for labeling the axes in figures (e.g., xlabel{' x_{n+1}'},<br />

ylabel {'\log{\dot{x}_n}}) .<br />

4. Bells and whistles: It is also possible to format the text with boldface<br />

letters, monospaced text (to mark <strong>MATLAB</strong> commands in comrnenLs), and<br />

bulleted list. You can use these text mark-ups with Cell ----> Insert Text Markup<br />

selections (see Fig. 4.4). For example, boldface text is created <strong>by</strong> enclosing<br />

the text with * on both sides of the text, and monospaced text is created<br />

<strong>by</strong> enclosing it within vertical bars (1). So, with just a smattering of these<br />

formats, here is our script file ready to be published.<br />

%% Publishing Reports - A Simple Example<br />

%% Description<br />

% Plot a spiral given <strong>by</strong><br />

%%<br />

% $$r ( \theta) = e-{ - \frac{\theta}{10}}, \quad 0\le\theta\le 10\pi$$<br />

% using the following steps :<br />

%%<br />

% * create data vectors theta and r<br />

% * plot the spiral using function lpolar l<br />

%% Create vectors theta and r<br />

theta = linspace (0, 10*pi ,200) ; % 200 points between 0 & 10*pi<br />

r = exp (-theta/10) ; % compute r<br />

%% Plot the spiral using polar plot<br />

polar (theta,r)<br />

' p.· w

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!