Search code examples
matlabsymbolic-math

Laplace transform of non-explicit function


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.

enter image description here

I think the problem comes from the fact that I'm trying to differentiate the function p with respect to t but I'm not sure. Is there a way to get the Laplace transform of the function f?


Solution

  • The problem resides in the definition of the parameters. In order for this code to work, a little change is necessary when it comes to defining the function "p"

    syms m ms k t p(t) f;
    f=(m+ms/3)*(diff(p(t),t))^2+k*(p(t))^2;
    

    It's worth noting that the variable "t" has to be defined before p. This code defines "p" as "symfun" wich is the type given to a function when is defined using symbolic toolbox.