02.03.2016 Views

MATLAB by rudra pratap

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.5 Publishing Reports<br />

129<br />

4.5 Publishing Reports<br />

You can create a fancy, formatted report in HTML, XML, WIE;X, MS Word, or<br />

MS PowerPoint (MS stuff only on PCs) using <strong>MATLAB</strong> 's built -in publisher. For a<br />

quick introduction, see Lesson 11 in Chapter 2. Here we discuss, step <strong>by</strong> step, how<br />

to generate a report using the <strong>MATLAB</strong> publisher.<br />

1. Create a script file: First, create a script file containing all commands<br />

required to do the computation or produce the desired result. Include comments<br />

where necessary to clarify the commands. Let us take, for example , the<br />

following script file.<br />

% Plot a spiral given <strong>by</strong> r = e-(theta/10) for theta from 0 to 10*pi<br />

% Create vectors theta and r<br />

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

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

% compute r<br />

% plot the spiral using polar plot<br />

polar (theta,r)<br />

2. Format the script as a cell script: A cell4 is basically a set of related<br />

commands that form one unit of computation, or a chunk of descriptive text<br />

that forms a unit. A cell could contain one command, many commands,<br />

or even no commands. The beginning of a cell is marked <strong>by</strong> the double<br />

percent character (%%). A cell continues until the beginning of another cell is<br />

encountered. The text in the line beginning with the %% character is used as<br />

the section heading <strong>by</strong> the publisher. All snch headings in a script are used<br />

<strong>by</strong> the publisher to create a hyperlinked taule of contents in the report. It is<br />

generally a good idea to have an overall title for the report, generated <strong>by</strong> a<br />

cell containing only the title, no commands, at the top of the script file.<br />

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

%% Description<br />

% Plot a spiral given <strong>by</strong> r = e-(theta/10) , 0

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

Saved successfully!

Ooh no, something went wrong!