Reputation: 284
I wrote a simple program to find the roots of a non-linear equation using numerical method known as Newton Raphson method, thus i need to calculate the derivative of function at some points. I use function "diff" which takes a string and returns its derivation then i use eval to calculate the slope of tangent line:
func='sin(x^2)';
x=4.5;
slope=eval(diff(func));
The code is inside a .m file which is along some other .fig files. Everything just seems to be fine when i debug/run it in GUIDE environment or via MATLAB's command window, there's only a warning that the function will be deprecated in a future release. But when i compile the files with the following command: "mcc -e file1 file2", and run the .exe it throws runtime error when it reaches that specific line with "diff" and beeps! Is there any other way to calculate the derivative (symbolic/non-numerical) that'd be also supported in an application file?
Upvotes: 1
Views: 474