ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   drawing rect function graph in excel (https://www.excelbanter.com/excel-worksheet-functions/56699-drawing-rect-function-graph-excel.html)

sulphox

drawing rect function graph in excel
 

Hi all,

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

Thanks for the help in advance.


--
sulphox
------------------------------------------------------------------------
sulphox's Profile: http://www.excelforum.com/member.php...o&userid=28979
View this thread: http://www.excelforum.com/showthread...hreadid=487122


MrShorty

drawing rect function graph in excel
 

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)


--
MrShorty
------------------------------------------------------------------------
MrShorty's Profile: http://www.excelforum.com/member.php...o&userid=22181
View this thread: http://www.excelforum.com/showthread...hreadid=487122


sulphox

drawing rect function graph in excel
 

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.


--
sulphox
------------------------------------------------------------------------
sulphox's Profile: http://www.excelforum.com/member.php...o&userid=28979
View this thread: http://www.excelforum.com/showthread...hreadid=487122


MrShorty

drawing rect function graph in excel
 

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.


--
MrShorty
------------------------------------------------------------------------
MrShorty's Profile: http://www.excelforum.com/member.php...o&userid=22181
View this thread: http://www.excelforum.com/showthread...hreadid=487122


sulphox

drawing rect function graph in excel
 

Ok. I understand now.

Thanks a lot MrShorty.:)


--
sulphox
------------------------------------------------------------------------
sulphox's Profile: http://www.excelforum.com/member.php...o&userid=28979
View this thread: http://www.excelforum.com/showthread...hreadid=487122



All times are GMT +1. The time now is 05:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com