0
Answered

quad my own function with mp object

hongtaowei 5 years ago updated by Pavel Holoborodko 5 years ago 5
hi, i have a function with its parameters of mp object, for example, k is a mp object, x is syms, and the function:phi=@(x,k,B) A*sin(k*x)+B*cos(k*x)-A*sinh(k*x)-B*cosh(k*x), I found it does not allow me to multiply k*x, how can I quad this function?
Under review
Please modify your program so that x become of "mp" type.

In general, there is no interconnection between "sym" and "mp" - since "sym" is of closed format of Mathworks.
We are not able to provide mixed-type operations for them.
Thanks for reply. But x is variable in the function, I try to use mp(x), it didn't work.
There is only one way of converting 'sym' to 'mp' - through the string:

x = mp(char(x))  % x becomes of mp type
Thanks a lot, to be honest, I have tried the function vpa() of the matlab its own, it seems to solve the problem, anyway, thanks, I will use vpa() to do my work in the hand.