how to caculate the slope of a certain point of wave

Dear all,

I have two questions.

One is how to caculate the slope of a point. In my case, I want to get the slope of point when x=0(pls see atteched graph)

The other is how to make a graph like second attached. The y axis is the value of constant. I want to make the ponits align lines with certain degree, just like in the graph.

Anyone can help?

Many thanks!
1_0.png
As far as your first question,

1. Identify the points where x=0. If you want to do a single point at a time, you can place a cursor on the graph at the point of interest, and calculate the slope near that point. pcsr(A) returns the location within the wave at which you have placed cursor A.

If however, you want to do this programmatically, it will take alot more effort as you have multple points at x=0, and I highly doubt they are exactly at x=0. This would require you to identify the points closest to zero, eliminating double counting (two points next to eachother which meet your criteria to be labeled as an x-intercept). One method to do this, is to scan the wave identifying the points where the sign changes.

2. As far as calculating the slope, you have a couple options. You can calculate the slope based on a linear regression formula, using the points closest to your x-intercept. You can fit a linear equation to the 4-6 data points surrounding your x-intercept.

The best option here however, would probably be to calculate the derivative of your wave using the Differentiate function. This will give you a new wave which contains the derivative of your original wave (remember that derivative = slope of original). You can then simply select the points which match up with the results of step one.


In regards to your second question, I've not made a plot like that before so I'll let someone else answer that one.