0

I'm trying to run this code

   syms x m
eq3 = m-['(heaviside(x)-heaviside(x-1))*x^3/6  ']; 
    %...
    % '(heaviside(x-1)-heaviside(x-2))*(1/6)*(-3*x) + ' ...
    % '(heaviside(x-2)-heaviside(x-3))*(1/6)*(3*x^3-24*x^1) + ' ...
    % '(heaviside(x-3)-heaviside(x-4))*(1/6)*(4-x)^3'];
eq2=-x+(.6/.0360)*m;

sol = solve(eq3,eq2);

But I keep getting this error

Function 'lt' is not implemented for MuPAD symbolic objects.

I searched and found that I needed to make x a double, so I tried that but instead i get this error when I put in the line x=double(x)

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 ==> sym.sym>sym.double at 927 Xstr = mupadmex('mllib::double', S.s, 0);

If I use VPA, and put the line x=vpa(x) I get the following error

Function 'lt' is not implemented for MuPAD symbolic objects.

Error in ==> sym.sym>sym.lt at 803 notimplemented('lt');

Please advise, thanks!

  • 1
    Could you format your code snippet as code please. See the little {} icon above the text edit box ? Select the code snippet, click on that icon and see what happens ! It will make the code easier to read and for SO to help you. And, while I'm here, make sure you don't have any stray definitions for 'lt' in your workspace which don't belong in your code any longer. – High Performance Mark Mar 14 '12 at 09:12
  • Should look cleaner now, thanks! Also, I have no definitions for 'lt' when I googled that error it said it's because I am using a symbolic variable, and to try casting it to a double. I tried that and it didn't work – user1265868 Mar 14 '12 at 20:20
  • For what it's worth, this is a continuation of [this question](http://stackoverflow.com/questions/9679897/matlab-solve-system-of-equations-with-quantized-variables). – Li-aung Yip Mar 15 '12 at 00:15

1 Answers1

0

Is this what you want?

eq3 = sym('m - (heaviside(x)-heaviside(x-1)) * x^3/6');
solve(eq3)
vharavy
  • 4,881
  • 23
  • 30