Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You want to check out Matlab's symbolic library (based on the Maple engine). The basic idea is that you'll want to create symbolic variables ('syms'), and then differentiate those expressions symbolically. Then you can convert between your symbolic expression and a function handle that will evaluate your symbolic expression at some coordinate values. See <a href="http://www.mathworks.com/products/symbolic/" rel="nofollow">here</a> for instructions on the syntax, the 'syms' library, etc.</p> <p>In real applications, though, you normally need to write your own software-function for the different mathematical-functions that you deal with. Then, only in special cases will you be able to analytically compute derivatives, and in those cases you'll want to write another, separate software-function for the mathematical-function that is the derivative. Symbolic libraries are usually very slow and they (at least currently) are an inefficient way to generate actual functions through handles.</p> <p>If all you'll ever work with are polynomials, however, this is a special enough case that you should be able to write a general Matlab function that takes in a coefficient list and a range of values as input, and outputs the derivative coefficient list plus the derivative function evaluated at those values. Here's an example:</p> <pre><code> function [d_coeffs, d_vals] = compute_poly_derivative(in_coeffs, in_values) num_terms = length(in_coeffs)-1; max_power = num_terms; for ii=1:num_terms d_coeffs[ii] = in_coeffs[ii]*max_power; max_power = max_power - 1; end d_vals = polyval(d_coeffs,in_values); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload