MATLAB: How to find Laplace transform of an implicit symbolic function

MATLABsymbolic

Hello everyone!
I am working with a function "p(t)" that is function of the time variable t. I don't have the explicit expression of "p" as function of time and I would like to apply Laplace transform to an expression that includes the function p. I started by defining all the parameters as symbolic in MATLAB :
syms m ms k t p f;
f=(m+ms/3)*(diff(p(t),t))^2+k*(p(t))^2;
When I execute those lines, I get this error:
I think the problem comes from the fact that I'm trying to differentiate the function "p" with respect to the parameter "t" but I'm not sure. Is there a way to get the Laplace transform of the function f?
Thank you!

Best Answer

You have to decalre ā€˜pā€™ as a function (available in R2012a and later versions):
syms m ms k t p(t) f;
f=(m+ms/3)*(diff(p(t),t))^2+k*(p(t))^2;
You can also use the symfun function to create ā€˜p(t)ā€™.