Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Derivatives in Embedded Matlab 1

Status
Not open for further replies.

alrubaie

Electrical
May 31, 2010
3
Hi there,

In Simulink, I'm trying to differentiate a function with respect to a non-time variable. So I created an embedded matlab function and wrote down the following:

function phi = func(B)
syms x;
phi = diff(cosh(B*x)-cos(B*x)...),x);

This function works if called from Matlab console, but with Simulink it complains that "command duality is not supported". What's the way to do it then?

Thanks,
Hasan
 
Replies continue below

Recommended for you

Analytically solve your differential and then include that in your function. ie get rid of the diff and syms statements

Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376
 
Hi Greg,

The function is way longer than what I typed above, that's why I put the ellipsis :p
I might be able to differentiate it this time, is there an easier way though?

Hasan
 
That was silly, never mind.
Thanks for the help.
 
I don't know. Perhaps mathworks support has a better solution. Have you looked through the functions allowed in embedded matlab for inspiration?

Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor