Having trouble writing code for average rate of change.

Using the piece wise function:
W(t) = 48+3.64t+0.6363t^2+0.00963t^3 when 1 <= t <= 28 W(t) = -1004+65.8t when 28 < t <= 56
I need to create an m-file that will calculate the average rate over time.
I've made an m-file for the piece wise function itself:
function y = W(x) if 1 <= x && x <= 28 y = 48+3.64*x+0.6363*x.^2+0.00963*x.^3; end if x>28 && x<=56 y =-1004+65.8*x; end
but am having trouble making the code for the average rate of change. I need to be able to plug in two points, (1,25) for example and get an out put. What is the code for this?

Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 11 Okt. 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by