How to plot a formula with two variables


I would like to plot a formula in this form
x + y = 0

I know u may say "rearrange it to y = -x" and plot it.  This is not what I 

I tried to write a code to generate data on the worksheet but I was 

this is what I am trying to do

for x values,
y = -10
For x = 1 to 10
Cells(i,1) = x
Function = replace(function, "x", x)

function = evaluate(replace(function, "y", y))
y = y + 0.1
loop until function = 0
Cells(i,2) = y-0.1

Next x

Can anybody help to write this code??

Alibaba (28)
9/28/2005 7:26:05 PM
excel.charting 18370 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 16

Why you should want to do this I cannot guess!
In column A (say A2:A22) enter the required x-values
In B (B2:B22) enter any y-values --- a series of 1's will do
In C2 enter =A2+B2 and copy down to C22
Open Solver, clear the Target box; the By changing should read B2:B22; add 
constraint C2:C22=0; solve
Plot A2:B22
best wishes
Bernard V Liengme
remove caps from email

"Ali Baba" <> wrote in message
> Hi
> I would like to plot a formula in this form
> x + y = 0
> I know u may say "rearrange it to y = -x" and plot it.  This is not what I
> want.
> I tried to write a code to generate data on the worksheet but I was
> unseccusseful
> this is what I am trying to do
> for x values,
> y = -10
> For x = 1 to 10
> Cells(i,1) = x
> Function = replace(function, "x", x)
> Do
> function = evaluate(replace(function, "y", y))
> y = y + 0.1
> loop until function = 0
> Cells(i,2) = y-0.1
> Next x
> Can anybody help to write this code??

bliengme5824 (3040)
9/28/2005 9:47:46 PM
Suspending judgement on why you want to do it this way:

Sub mysub()
Set rng=desired range
With rng
For x=1 to 10
loop until abs(f)<1e-6
'I often prefer to test for almost 0 rather than exactly equal to 
because of rounding error when decimal fractions are converted t
binary in the IEEE system
next x
end with
end sub

check the syntax, I wrote that quickly.  Debugged, it should do exactl
what you've asked for, no less, and no more.

I'm guessing this is just a test case for future, more comple
problems.  If this is true, you might consider looking into differen
numerical algorithms for solving f.  A Newton-Raphson algorithm will b
more certain of finding a solution, and will find it more effecientl
than the algorithm we've used here.  We also haven't dealt with case
(like x-y^2=0) where there is more than one possible y value for each 
value.  Bernard's approach using Solver in a worksheet will work wel
for most other equations, though it won't have a way of determinin
when multiple solutions exist

MrShorty's Profile:
View this thread:

9/29/2005 5:13:20 PM

Similar Artilces:

This is a multi-part message in MIME format. ------=_NextPart_000_0015_01C50860.E8475A00 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: quoted-printable Are there in Visual C++ plots drawing library like BCB TeeChart? Thanks in advance. ------=_NextPart_000_0015_01C50860.E8475A00 Content-Type: text/html; charset="koi8-r" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; charset=3Dkoi8-r&q...

plotting long plots
I have a HP designjet 110 nr plotter. I've created a plot that we nee to show drilling activity. My first plot was 24"x36". Plot works grea and to scale. My next plot was to be 24"x72". Now the charts will no even display in Print Preview. I can scale back the plot where it i about 48" and it will preview and plot, but I need it to go out eve futher than 72 inches. I may go out as far as 30 feet. I have images on the plot area and it will print it just fine at th farther distances -- TexasDa -----------------------------------------------------------------------...

why does a formula not total right?
I have say =sum(E1+G3) E1 = $10.00 G3 = 8 The cell I put this formula in comes up (2 or 3) cents off. This does not happen all the time but off & on. -- Kind regards, Niek Otten "Kickstart" <> wrote in message >I have say =sum(E1+G3) > E1 = $10.00 > G3 = 8 > The cell I put this formula in comes up (2 or 3) cents off. > This does not happen all the time but off & on. > Sounds like one of the cells co...

Excel Formula Problem
Is there anyone out there that can help me with a function please. My objective is a formula which will read from a list of items and count them, giving the result in a separate column/cell, ONLY if another cell in a column says "Y" NOT counting the item if it says "N" ? Thanks Hi, =SUMPRODUCT((A1:A10="??")*(b1:b10="Y")) change range to fit your needs "Carol @ Prison" wrote: > Is there anyone out there that can help me with a function please. My > objective is a formula which will read from a list of items and count them, ...

Charting the relationship between two cells
Can you / How do you chart a the relationship between two cells (preferably without making two tables). It feels like this should be a simple function of excel. I want to see how a cell is effected when I put numbers 1-1,000,000 in it. For example, I have a worksheet that asks how many units I am managing. I put in that number in a single cell and my worksheet comes alive telling me how many people I need to have, how much space I need, etc, etc. But most importantly it shows me the bottom line profit. I want to chart the relationship between those two cells (number of units and pr...

Lookup value that falls between two values in a range and then som
I have an array with 4 columns: A B C D 1 435 578 ID1 2 12 113 ID2 3 1478 1879 ID3 etc etc etc etc The value I want to lookup has two components that correspond to column A and a number that falls between columns B and C (or not): E F 1 78 2 86 2 1500 3 1600 etc etc So I'd like to ask is the value in column E = to the value in column A AND does the value in column F fall between the values in columns B and C? If yes, return column D. In this examp...

Plotting Data
Hi, how can I plot the analysis data in the document class, in its related view class. Is it possible to make plots like in MATLAB (surface plots,mesh plots of a matrix)??? ...

Creating cell references with variable values to use in Vlookup
I would like to create cell references within a Vlookup statements using variable data within a cell to access a coresponding worksheet within the same work book eg worksheets would be Monday Tuesday Wednesday and the worksheet that would be calling the data would have a column with the same values -- jackebro ------------------------------------------------------------------------ jackebro's Profile: View this thread: With worksheet name in D1 =VLOOKUP(A1,IN...

Copying formulas to another worksheet
Can anyone please help me, I am trying to copy a formula =(sump1:p3) from one worksheet into a new worksheet. When I go to paste the formula the only thing that comes up is =SUM(#REF!). Can I even copy and paste a formula from one worksheet into a new worksheet? and if so how? Thanks When you paste a formula it relatively changes the cell references to suit where you have pasted it to. EG. If you pasted =sum(P1:P3) from cell P4 to cell B4 it would change to =sum(B1:B3). However, if you pasted it to cell B2 it could not reasonably change the references. If you are pasting because you...

looking for a possible formula
is it possible to create a formula for this in excell? File Attached: (sample.xls) ------------------------------------------------ ~~ Message posted from ~~ View and post usenet messages directly from ...

Need to print formulas
Hello all! Using E02 on XP. Have linked cells in OutFile.xls 'reading' data from InFile.xls. Rather than handwrite my cell mapping, how can I print the linked cells or the formulas? Example: InFile has: A B C 1 10.45 9.32 3.25 2 9.87 5.98 5.32 3 12.87 10.11 7.42 OutFile has: D L V 10 ='S:\[InFile.xls]P4'!A1 ='S:\[InFile.xls]P4'!B1 ='S:\[InFile.xls]P4&...

Updating Variable Rate Loan where payment stays the same.
Hello, I'm hoping someone will be able to help me out. Or perhaps offer some suggestions... I'm using MS Money 2004 and have setup a variable rate loan (for my Canadian mortgage). Whenever my bank changes their rate, my payment does NOT change. Only the ratio of how much of my payment goes to interest and how much goes to the principal changes. Apparently, MS Money doesn't recognize this type of loan agreement as it changes the entire payment amount to reflect the new rate. I thought I could get around this problem by simply accepting the payment amount that MS Money calculates, ...

Dear member, I have a question . The question is how to make a graph=85.I do know your name or kind For example I have range the value of mean and variance. I need to plot the two in same graph how is attachad . mean var tn 287.787 120.619 t12 2.147.523 13.843.230 t18 2.698.113 22.254.429 t24 3.288.497 17.780.971 td 1.841.121 7.918.387 Anyone have one idea.. how to make it? Thanks&Regards Jen Hi, Highlight all the data, with titles and click the Chart Wizard button and choose a line chart type, follow the wizard. However, your first two data points are very large relative to al...

execute $variable LATER
$a = "$computer `t $computer_lastlogon `t $computer_pwdlastset" | out-file -filepath c:\results1.txt -append =================================== I wish to store the above statement in a variable, and to EXECUTE LATER. How do i prevent $a from execution until i decided to put in somewhere in my script as $a ? If I follow: PS>$a = "$computer `t $computer_lastlogon `t $computer_pwdlastset|out-file ...." wait PS>invoke-expression "$a" "IT Staff" <> wrote in message news:OcNiG6BwKHA.5036@TK2MSFTNG...

formulas #2
I know how to write formulas, but I was wondering how to convert the answer from the formula into just the answer so I can cut and paste just the answer. ------------------------------------------------ ~~ Message posted from ~~View and post usenet messages directly from Terry, copy, paste special valve -- Paul B Always backup your data before trying something new Using Excel 2000 & 97 Please post any response to the newsgroups so others can benefit from it ** remove news from my email address to reply by email ** "terry"...

Access docment's member variable
How can I access a document's public member var. There could be up to 8 documents of the same type open at any time. I added code using an MSDN article as follows: //this code is in theApp file POSITION pos = m_pTestTemplate->GetFirstDocPosition(); while (pos) { CDocument * pDocument; if ((pDocument=m_pTestTemplate->GetNextDoc(pos)) != NULL) { //this is where I want to access the member var } } My document's member vars cannot be accessed from the pDocument pointer, so does anyone know how this should be coded? Thanks in advance. 1. Assuming that all the do...

creating a formula
i am relatively new to using computors and i was wondering if i can create a formula to work out what is left from a total if where the total is constant for instance hours in the day =24 (b9) and some of the hours are used e.g. eating 1 hour (b3) sleeping 7 hours (b4) using p.c. 3 hours (b5) watching t.v. 2 hours (b6) work 8 hours (b7) is there an equation i can use to automatically fill in misc. (b8) bugsy In b8 type: =B9-SUM(B3:B7) Andy. "bugsy malone" <> wrote in message > ...

Graph not plotting what it should be plotting
I am having difficulty with Excel and was hoping someone could be of assistance. I am plotting a series of graphs with time on the x-axis and water level on the y-axis. The first set of graphs looks good. If you put the pointer over one of the points on the x-y scatter plot graph you see: "EW-5 Pump Test" Point "4321.00" (4321.00, 2445.04) 4321.00 is time in minutes and 2445.04 is the water level in feet. However, my next series of graphs for the same well (plots the same type of data for another event) looks like: "EW-5 Recovery Test" Point "43...

drawing box plots with excel
I have different sets of data and would like to draw box plots (Minimum lower quartile, medium, upper quartile, maximum) to present them. I there any way to do this with excel or do you know another program that might help? Many thanks -- Message posted from do you want to actually plot the box or do u want excel to work out the results for the upper quartile ect? MVP Jon Peltier has some instruction on his site for creating box and whisker charts: oxWhisker HTH Jason Atlanta, GA >-----Original ...

plots sent to to a chart tab do not show plot & I loss the plot
I have a spreadsheet that has a chart tab with a plot of data from another part of the spreadsheet. Now, however, the chart is empty and when I try to send any plot to a chart tab the plot is lost and the chart tab is empty. This is happening now in all my spreadsheets the plot can be created within a spreadsheet but as soon as I move it to a tab the plot is lost and the chart tab has nothing in it. !!!????!!!! ...

XY Scatter Plot
I have a stringline chart I have made out of the XY scatter plot chart for trains in our area. The file is a program that allows users to input a train number (e.g. 520), start time (8:20 - using military time) and a starting location and an ending location. This if for my boss so he can experiment with various train schedule and see the trains in a stringline diagram (time of day vs. mileposts for each train). I currently have all the trains plotted against the mileposts and, correctly, some trains start and end midway where as others complete the entire run. My problem is I am getting some ...

How to get background gradient with two colors I choose
I have PP 2007 with Windows XP. I click Design>Background and get the Format Background window. Then I select Gradient fill. I get a diagonal gold wavy gradient with white as the second color. How do I choose the colors that I want and have the same gradient? The gradient stops are incomprehensible to me, and no matter what I do with them and the colors, I can't get just the two colors I want. How do I get a gradient with two colors of my choosing? It's a terrible interface, isn't it? should explain. (I'm very glad the ...

Is it possible to hide errors in cells having array formulas
Hi I have array formulas in a worksheet. But some cells throw up error value's such as div!/0 etc. i want to hide these errors but somehow am not able to type the right function using iserror(cel_ref). Can anybody tell me how to use ISERROR with array formulas Regards Manan -- manan ------------------------------------------------------------------------ manan's Profile: View this thread: Hi Manan! You can use the ISERROR together with conditional IF f...

Complicated formula
I have an Excel sheet with probably 1200 cells. Each cell may contain a character which represents a numerical value (ex. P = .75, R - .50, etc.). Certain letters represent a higher value, and I want the higher of the two values. How can I compare every cell and arrive at a number? Thnaks try =IF(CODE(C10)>CODE(C11),C10,C11) or =IF(upper(CODE(C10))>upper(CODE(C11)),C10,C11) -- Don Guillett SalesAid Software "A. Stern" <> wrote in message news:ZzgNh.188$786.172@newsfe03.lga... >I have an Excel sheet with probably...

Formula please
Hi, hope someone can help. I am trying to get a value in dollars in one cell dependant on another cell being one of two letters. If a particular letter appears then the cell will give the result of a third cell multiplied by 9%, if it is a different letter it will give 9% of another cell. eg the result will be in K30 if K15 is "T" then k30 will be p20*9%, but if K15 is "P" then K30 will be P21*9% Thank you if anyone can help. Mel One way: =IF(K15="T", P20*9%, IF(K15="P",P21*9%,"Not T or P")) In article <eM1rjLTaGHA.3328@TK2M...