drawing rect function graph in excel

  • Thread starter Thread starter sulphox
  • Start date Start date
S

sulphox

Hi all,

We are able to plot sine n cosine graph using excel. is there any wa
we can plot
rect graph using excel?

Thanks for the help in advance
 
Consider porperties of y=sin(x) (x in radians)

maximum values (amplitude): 1, -1
0 values (crosses x axis): 0, pi, 2pi, 3pi,... (period=2pi)

Pick a starting point (0,0) and plot the series:

x y
0 0
0 1
pi 1
pi -1
2pi -1
2pi 1
.. .
.. .
.. .

From there it's not too difficult to relate x and y to the generic
y=Asin(Bx) where A=amplitude (y=A or -A) and 2pi*B=period
(x=i*period/2)
 
Thanks MrShorty..
i've tried your method.

i put x as =PI() -->A4
my Y is =SIN(AA)

However the ans that i got for Y is 1.22515E-16

Basically my answer is
X Y
0 0
0 0
PI 1.22515E-16
PI 1.22515E-16
2PI -2.4503E-16
2PI -2.4503E-16

is there anything wrong with my steps?
Please advise.

thanks.
 
Nothing wrong (other than that series of Y values will plot a line
essentially down the x axis rather than a square wave). Basically,
you've discovered that a computer can't represent an infinitely long
number (like PI) within the finite confines of its memory. In short,
the function PI() doesn't return exactly PI, but rather a 15 digit
approximation to PI. Then you put this approximation to PI into the
SIN function and you get an approximate value for the SIN(PI). You've
got to admit, 10^-16 is awful close to 0.

This "round-off error" gets discussed quite a bit in these forums. See
http://www.cpearson.com/excel/rounding.htm for a discussion as it
applies to Excel, the Microsoft knowledge base has a page or two
dedicated to round-off error and the IEEE standard. Since this problem
isn't unique to Excel, but applies to all computers in general, there
are probably a lot of places on the net and in numerical method or
programming texts where this issue is discussed.
 
Back
Top