MATLAB: Differantation of a function with multiple unknown constants

#differentiate #derivate #function #differentiateoffunctionMATLAB and Simulink Student Suite

Hi Everyone! I got a function phi(t)=exp(x*y*t)*(C1*cos(z*t)+C2*sin(z*t)+A*cos(h*t-w) and I have to derive it, but I do not really know how to do it. The problem is that I know everything except C1 and C2 and I am looking for those constants. I have two initial conditions with whom I can solve the equations after the differentation.

Best Answer

syms h w x y z t A C1 C2;
eqn = exp(x*y*t)*(C1*cos(z*t)+C2*sin(z*t)+A*cos(h*t-w))
dt = diff(eqn, t);
bc1 = subs(dt, [h w x y z t A], [known_h, known_w, known_x, known_y, known_z, known_t, known_A])
bc1 is linear in C1 and C2. Do another such subs() with different known values to get another linear equation. You can then solve for C1 and C2.