[[+content_image]]
T
T
tenset2016-12-11 16:06:02
MATLAB
tenset, 2016-12-11 16:06:02

How to fix Error in MuPAD command error in Matlab?

I use a function with input parameters, then find the minimum of the function using fminsearch:

syms x1 x2 x3 h
x = [0, 0, 0];
p = [ -4, 0, 1];
A =
    [[22;    28;    12];
    [28;    39;    15];
    [12;    15;     7]];
b =  [4;  0; -1]
L = x - h * p;
L = L';
fNew = @(h)(1/2 * dot(A * L, L') - dot(b, L'))
h0 = 0;
L = fminsearch(fNew,h0)

I get an error
The following error occurred converting from sym to double:
Error using mupadmex
Error in MuPAD command: DOUBLE cannot convert the input expression into a
double array.

If the input expression contains a symbolic variable, use the VPA
function instead.
Error in fminsearch (line 191)
fv(:,1) = funfcn(x,varargin{:});
Error in Projection2 (line 60)
        L = fminsearch(fNew,h0)

If you don't use variables,
fNew = @(h)((263*h^2)/2 - 17*h)
matlab decides everything.
I hope for a solution, thanks)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question