[t,z] = ode45(@(t,z) odefunw1(t,z), tspan, z0);
Okay, ode45 will invoke odefunw1
function dzdt=odefun1(t,z)
which will receive the parameters through the same names as in the outside (no complications about different variable names.)
ode45 always passes the first parameter, t, as a numeric scalar.
Using the / operator with a scalar on the right hand side is acceptable and will produce the same value as if you had used the ./ operator, so this line is okay
Another scalar, not a problem
diff() applied to a numeric array is the numeric difference function that calculates the numeric difference between adjacent entries. You are passing it a numeric scalar. Because there are no adjacent entries to a scalar, the output of diff() applied to a numeric scalar is empty.
dzdt(2)=(g+h)*z(1)-f*z(2);
Because h is empty, the right hand side of that equation is empty.
When you look back at the mathematical formula, we see that your h corresponds to the formula term
where
. You should be taking the mathematic derivative of that, getting
so inside the function you should calculate h as that formula.