Exact arithmetic, MATLAB Programming

Run the MATLAB script
sum = single(0); term = single(1);
n=1;
while sum + term > sum
sum = sum+term;
n=n+1;
term = 1/n;
end
n

Explain what you think it is trying to do. What would this code do in exact arithmetic?Describe why the code produces a nite result and (harder) describe the output. What would happen (don't try it!) if you replaced the fi rst line with sum=0; term=1;?

Posted Date: 3/22/2013 7:03:16 AM | Location : United States







Related Discussions:- Exact arithmetic, Assignment Help, Ask Question on Exact arithmetic, Get Answer, Expert's Help, Exact arithmetic Discussions

Write discussion on Exact arithmetic
Your posts are moderated
Related Questions
Your task is to implement the PHYSAT algorithm in Matlab to classify the phytoplankton species in the data you have selected. An algorithm demonstrating one solution is provided be

-The program should run always until the user enters -1 to exit from the program. - In the main, you should ask user to input any angles in degrees (Ad) and an integer number (N).

256789;267825;625892;982895;598289

Code and decode a 32 bit long data for a specific user in CDMA if there is only 1 user and no noise.

how to write a program to determine the day of the week. using GUI.

Variable numbers of arguments: In the functions there have been a fixed number of input and output arguments. For illustration, in the function below, there is one input argum

cAN Can I learn Metlab .I am X Scientist in DigitalCommunication. Can U please help me.I know the programming concepts

String Manipulation: The string in MATLAB software consists of any number of characters and is contained in the single quotes. Actually, strings are considered as vectors in w

1. Assume that there exists a surface that can be modeled with the equation:  z = e-(x 2 + y 2 ).  a) Calculate ∇z at the point (x = 0, y = 0). b) In addition, use MATLAB to

In this lab, we implement vectors, script and functions with plot. Plot function is used to plot the point into graph. These plots are handled by handle (h).  These handle is used