How to draw a line parallel to the linear portion of the curve in excel? - excel

I have stress strain data from tensile test. I have drawn a stress vs strain graph in excel.I need to find the yield point.For that, I need to draw a line parallel to the linear(straight) portion of the curve with 0.2% offset in x axis and see where it intersects with the original curve.
So, I tried to keep only the linear portion data and drew a trendline, which gives me straight line equation y=mx. Now, if I want 0.2% offset, equation of line is y=mx +c.
I have the equation, how to draw this line in excel with the equation? And how to get the intersection point? Is my approach right? Please help.

A Stress-strain curve with data courtesy of YouTube:
It can be observed that this is linear (elastic deformation) for about the first nine data points. Hide the other data points and add a liner trend line to the chart, with Display Equation on chart. This shows y=4232.x + 0.701.
In say N1 =4232*D2+.701 and copied down to N10 provides the data for an additional data series. Copy N2:N10, select the chart, Paste and format the added series to see the match:
For a 0.2% offset x is .002 when y=0. For a parallel line the slope (determined by 4232 in the formula) cannot be changed so the constant must be, from +0.701 to -7.763. A further data set can be created with the altered constant and added to the chart as before:
By observation the offset yield strength (0.2% proof strength) can be seen to be around 80 MPa in this example (where the green line intersects the blue curve).

Related

Calculate a plot and intersect on a curve in an excel chart based on a single value

I have some data that I'm using to plot a curve in excel. It uses a non-linear calculation.
The calculation is called the rule of twelfths - it is used to calculate changes in tidal height between a high and low tide. The rule states that in the first sixth (often approximated to an hour) of the time period, the tide will move 1/12th of the overall range. In the second sixth, the tide will move 2/12th's of the overall range. In the 3rd and 4th sixth, the tide will move 3/12ths (in each), and then it will move 2/12ths again in the fifth sixth, and 1/12th in the final sixth.
The maths for this is relatively straightforward - if I know the High Water Time and Low Water time, and their respective heights, I can calculate a data point for each sixth. That then plots to a nice even curve (and some fun pie chart shenanigans shows it on a clock face too).
This produces the following sheet:
What I am now after is the ability to overlay onto that the height for a given time of day. This would be used in a 'live' sense to display the height 'now', or perhaps where the user dragged their finger on the curve if it was in an app. I'm only using this for screenshot/flat file purposes, so I just need it to base the overlay one the data in one cell.
So, in the attached screenshot, if we had a time of day of 1128, (based on Cell J3), excel would take the time in J3, and wherever it intersected the curve, draw both a vertical and a horizontal line, so that the height of tide data (HOT) could be measured off that axis.
This would look something like this (I've circled cell J3 too):
Is that something that's possible? It might be that it needs to do a lookup in the table of calculated data points and then interpolate just between those two - that would probably get close enough.
A two stage question I guess - firstly calculating the intercept, secondly getting it to draw on (complete with the vertical and horizontal lines if possible!).
There's a widget on planetcalc which does almost the same thing - it only gives the calculated data points (and it uses hours rather than the range), but it gives a nice visual idea.
PlanetCalc Tide Calculator
Any thoughts? Is it possible?
I created a solution to this myself in the end.
Given that the two values were easily calculated, I produced a pair of values for the desired time/height, and plotted each as an additional line graph on top of the existing (styled correctly).
This gave the appearance of what I wanted, and intersected my curve perfectly.

Given two curves(both formed of certain points),firgure out point count of one curve over another

As the pic show, both curves are of spline line, and have limited points. I want to figure out the count of green points. Is there any idea?
I assume the black curve is x-monotone (otherwise the "one above the other" term can be ambiguous).
A simple approach is to consider the black curve as a polygonal line and for each point p on the red curve find the point q on the polygonal line with the same x-coordinate. Then the green points are those p that have a larger y-coordinate than their corresponding q.
Finding the point q corresponding to a given p amounts to going over the segments of the polygonal line and identifying segments that have one endpoint with smaller x-coordinate and the other with larger. Once you have such a segment the y-value of q is just a linear interpolation.
Since the polygonal line is x-monotone, the x-coordinates of the points are sorted. Therefore, the search for the corresponding segments can be done efficiently using logarithmic binary-search.

Measure two max value in Excel graph

In the context, I have a star spectral graph and there are two spectral line. The coordonate of graph are : x = Angstrom and y = relative intensity.
For example, on 6562 Angstrom there is a relative intensity of 2.12 and on 6520 Angstrom 2.19.
I would like measure the highest spots on the graph for more measurement.
I use Excel.
for example this picture (two spectral line example)
(source: shelyak.com)
how could I find these two points in automatic ways?
Add a third column to your data with the following formula:
'Assuming your data for "Relative intensity" is in column B
=IF(B1>=LARGE($B$1:$B$100,2),B1,NA())
Then, add an extra series to your line plot with this column (which should have only the 2 highest values and #N/A for the rest). Hide the line, add markers and data labels for this new line on your plot. You should get something like this, which updates automatically to highlight only the 2 highest values.
EDIT: Added a screenshot of my graph with 1500 points. Here I changed the formula to reach the end of my data table (this will of course not be exactly the same range on your sheet. look at where your data starts and where it ends):
=IF(B2>=LARGE($B$2:$B$1502,2),B2,NA())

Interpolated curves between existing curves do not look correct

I have a chart that has several existing curves on it that I have tried to interpolate new curves in between. I have used linear interpolation in the form of y = ((x - x1)(y2 - y1) / (x2 - x1)) + y1, however the new curves look out of place.
You can see in the picture that every second line (from the bottom) is the interpolated line. While the very second line data points are exactly centered between the first and third data points in the y axis, the third line data points are not centered between the second and fourth y data points, making the graph look skew.
So I am thinking linear interpolation may not be what I am after here. Can someone recommend another method that would create curves between the existing ones, but replicates the same form?
Sudden changes in gradient are hard to interpolate. When you're at the point where you want an interpolated line to suddenly change gradient, there is no information from the points in close proximity that give information as to where the sudden change in gradient should occur.
To replicate the pattern, you actually need to copy the gradient of the line below then smoothly transition to the gradient of the line above. Visually we can see that it should occur half way between the change in gradients for the lines above and below on either side, but detecting the locations of those changes is not trivial.
The points where the sudden change in gradient are occurring are separated by a large change in the x-axis by only a small change in the y-axis. When calculating y-values for x-values in between the the changes in gradient you get the aberrations. I suggest trying to interpolate x-values based on y-values instead. For each curve, for each small arbitrary step in the y-axis, find/calculate the closest x-values from the curve on either side and take the average to plot your interpolation.
An unconventional approach may be a piece-meal style of interpolation. It may be possible to model the 3 regions of different gradients separately.
Start by identifying the 2 lines that would be drawn through the 2 sets of kinks, creating 3 regions of space. The vertical line would stop at the horizontal line near the bottom right corner of the graph.
For each region (and potentially for each value of x in each region) determine the gradient of the lines. When you're doing your interpolation of a new line, for each starting point (x1, y1), look at which region it falls in. Use the gradient of that region as a significant factor when determining the next point. Keep doing this until you reach a region boundary. When the interpolated point crosses into a different region, then use the gradient of that region as a significant factor to interpolate the next point.
It will be quite pointy if you did this strictly, so graph with some smoothing (or incorporate a smoothing factor using weighted averages of the gradients as you transition between regions, but this could be a whole lot of effort without necessarily closer results!)

Predicted vs observed plot with diagonal line and deviation

I am trying to plot predictions vs observations in a scatter plot showing the predicted values in x and the observed in y, so a perfect fit should be shown in the diagonal. Is there any way to plot that diagonal in excel as a line, so it is easier to see if the result is close to the ideal? Also, my model has a standard error that I would also like to show as upper and lower line. Something like this:
Any ideas how I could add the lines in excel? Thanks !!
[edit]
This happens if I add a new series to draw the diagonal line as a line plot:
Where 'line 1' gives me what is shown in the center image after I add a new series, and 'line 2' the one of the right if I add the cells to a existing axis. What I'm doing wrong? thanks
Create a new series for each line, with just two points for each series.
For the diagonal, the first point is at the intersection of the axes and the second is at the top right of the charted area. Format the series with a suitable line and no data points.
For the upper and lower lines, same technique but the first point is where the line intersects the y or x axis respectively.

Resources