excel help
Bits
Posts: 414
I am trying my best to plot a function in excel. Can someone give me an example?
I want to plot these data using a transverse equation. Most of the variables will be static yet I want to be able to view the changes.
Starting at row 1 column A
With the equation
I want to plot these data using a transverse equation. Most of the variables will be static yet I want to be able to view the changes.
Starting at row 1 column A
[TABLE="width: 128"] [TR] [TD="width: 64"]Vin[/TD] [TD="width: 64, align: right"]2.5[/TD] [/TR] [TR] [TD]Rf[/TD] [TD="align: right"]15[/TD] [/TR] [TR] [TD]Rc[/TD] [TD="align: right"]15[/TD] [/TR] [TR] [TD]Vref[/TD] [TD="align: right"]2.5[/TD] [/TR] [TR] [TD]Vout[/TD] [TD="align: right"]2.5[/TD] [/TR] [/TABLE]
With the equation
=(-B1 * (B2/B3) )+(B4 *((B2+B3)/B3))
Comments
Arrange your data on the spreadsheet so the two data sets are side by side (x and y), select the data, click the graphing wizard icon and use a X,U scatter plot.
You could have any of the values in your equation be the dependent ("X") value but you'll probably need to use a different graph for each dependent value. The other values in your equation would be treated as constants.
EDIT: Here is spreadsheet with some VBA code to vary the Rf Vin value and the chart will reflect the new value.
You can only make a two dimensional plot with Excel (as far as I know). You can have multiple data sets ploted on the same graph but I don't think you can graph your function with multiple changing variables.
Here's my attempt at plotting some data.
The above is the graph of the result based on two different changing variables (but only one changing variable per graph).
I used one graph with points and the other with just a line for some variety. Many of the data sets aren't very interesting since they just produce a horizontal line.
I'm not sure what she is looking for either, but this version has two scrollbars to control Vin and Rc.
More scrollbars could be added...
That's very cool. I don't think I've seen scroll bars used like that in Excel before.
I've often wanted to graph equations that use more than one dependent variable. It's seems very awkward to have to make a different graph for each variable being changed.
Ron Czapala,
Wow that is a cool feature using the scroll bars like that.
Duane Degn,
You have the correct plot.
If I could use Ron's scroll feature and Duane's plot this might work.
Thanks guys.
Bits,
I'm glad you found it useful. I really don't use Excel a lot so it was an interesting challenge - the Excel Object Model is complex.
I tweaked the VBA code in post #10 to handle clicking the arrows on the scroll bars in addition to the slider,
and if you change the values in a cell, the scollbar reflects the new value.
The scrollbars MAX/MIN properties should be set appropriately - I multiplied/divided them by 10 in the code so values could be adjusted to one decimal position.
Here is the code:
I modified the code to create the same data and chart three different ways.
In one the cell names are hardcoded (e,g. "A1").
The second uses a for..next loop and uses the format "Range(Cells(x,y),Cells(x,y)).Select"
The third uses a for..next loop but builds the cell name as a string and uses the format "Range(varname).Select"
You could write code to vary your Vin, Rf, etc values and calculate the Vout value and put them in a range of cells, then dynamically create the appropriate type of chart.
Constants: Rf = 15 Rc=15 & Vref=2.5
The Vin and Vout values are placed in the A & B columns and the chart is created.
(All data and chart are created by program code).