I'm not sure how your function
is given to MATLAB. But suppose that it is in a function file PofT.m. You simply have to include a call to PofT in your differential equation, like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/241359/image.png)
function f = odef(t,a,m,sigma)
f(1) = a(3);
f(2) = a(3) - a(2)*abs(a(3));
f(3) = (1/m)*(PofT(t) - sigma(1)*a(2) - sigma(2)*f(2) + sigma(3)*a(3));
end
Or something to that effect. I used the response variable a = [y,z,w] and sigma having indices 1,2,3 instead of 0,1,2.
If you have measured
then you will have to include a call to interp1 or some such function in your definition of
for all times t.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/241360/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/241361/image.png)
Alan Weiss
MATLAB mathematical toolbox documentation