Scripts with input and output, MATLAB Programming

Scripts with Input and output:

Placing all this together, we can implement the algorithm from the starting of this section. The following script computes and prints the area of a circle. At first it prompts the user for a radius, reads the radius, and then computes and prints the area of the circle based on this radius.


967_Scripts with Input and output.png

Executing the script generates the output as shown below:

>> script2

Now enter the radius: 3.9

For the circle with radius of 3.90, the area is 47.78

Note that the output from the first two assignment statements is suppressed by putting the semicolons at the end. That is often completed in scripts; therefore the exact format of what is displayed by the program is controlled by the fprintf functions.

Posted Date: 10/18/2012 5:57:02 AM | Location : United States

Related Discussions:- Scripts with input and output, Assignment Help, Ask Question on Scripts with input and output, Get Answer, Expert's Help, Scripts with input and output Discussions

Write discussion on Scripts with input and output
Your posts are moderated
Related Questions
I have an assignment to do by MATLAB : the assignment is to design Script that makes (Panorama Stitching) for multiple pictures .. for more information see the link :

The purpose of this assignment is to use Matlab/Simulink to analyse and simulate a mathematical model of an electromechanical system. This system comprises two component subsystems

Input in a for Loop: The script below repeats the process of prompting the user for a number, and echo printing the number (that means simply printing it back out). A for loop

Finite Difference Method for An Elliptic Partial Differential Equation   Problem  Use the finite difference method and MatLab code to solve the 2D steady-state heat equat

Expand a matrix: To expand a matrix, an individual element could not be added as that would mean there would no longer be the similar number of values in every row. Though,

Linear indexing: This is termed as linear indexing. It is generally much better style when working with the matrices to refer to the row and column indices, although. An in

how to code this function

Customizing a Plot: Line Types, Color, Marker Types: Plots can be completed in the Command Window, if they are really simple. Though, at many times it is desirable to customiz