Running Rate of Change given two different columns if a criteria is met
3 views (last 30 days)
Show older comments
Good Morning all,
I am looking to accomplish the following. I have 6 Columns i wan to calculate a running rate of change that starts as soon as s = 1 and ends the running addition when s = -1 and just keeps on doing it across the entire column. As for the rate of change, it should take the first "pc" value when s = 1 as the base and just keeps calculating it all the way down...(see example below). This needs to be calculate using "ph" and "pl". Please see Excel file attached with my example.
ph pl pc s rocl roch
32.15 28.58 31.51 0
33.65 31.27 33.65 0
40.42 33.57 39.75 1 pl / pc ph / pc
43.22 39.62 42.6 1 -0.33% 8.73% rocl = (39.62/39.75)-1 roch = (43.22/39.75)-1
45.32 41.02 41.44 1 3.19% 14.01% rocl = (41.02/39.75)-1 roch = (45.32/39.75)-1
42.55 0.67 38.49 1 -98.31% 7.04%
39.7 35.81 36.02 1 -9.91% -0.13%
41.46 35.86 41.23 1 -9.79% 4.30%
43.06 40.16 41.64 1 1.03% 8.33%
44.51 39.88 44.47 1 0.33% 11.97%
44.9 41.58 42.41 1 4.60% 12.96%
42.77 38.26 39.4 1 -3.75% 7.60%
41.09 0.98 38.71 1 -97.53% 3.37%
39.97 0.24 0.52 1 -99.40% 0.55%
40.95 0.64 40.51 1 -98.39% 3.02%
42.36 40.02 41.25 1 0.68% 6.57%
44.06 40.05 44.03 1 0.75% 10.84%
44.06 0.91 38.69 1 -97.71% 10.84%
39.8 33.73 34 1 -15.14% 0.13%
34.03 28.75 29.38 1 -27.67% -14.39%
30.01 22.18 23.46 1 -44.20% -24.50%
23.42 18.47 19.8 -1 -53.53% -41.08%
56.8 48.21 56.08 0
60.26 55.77 56.4 0
59.12 55.15 55.55 0
55.54 48.07 48.25 0
56.44 48.11 53.69 0
Thanks so much for the help! Appreciate it very much!
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!