Engineering Matlab question

I am an engineering student doing a term project on a slider-crank mechanism, and in getting the differential equation for the slider, I keep getting an error. We are given values for theta = pi( t^2/2 - t^3/2) for 0 <= t <= 1 and theta = 0 for t > 1. I got the equation for the slider as: s(t) = a(1-cos(theta)) + b - sqrt (b^2 - (asin(theta))^2)

I've never taken a matlab course but it is required in this project, and when I try to plug in the equation for the slider, I get the following errors:

>> syms a b t;
>> f = a(1-cos(pi*(t*t/2-t*t*t/2)))+b-sqrt(b*b-(asin(pi*(t*t/2-t*t*t/2))));
??? 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 ==> sym.sym>sym.double at 927
Xstr = mupadmex('mllib::double', S.s, 0);

Error in ==> sym.sym>privformatscalar at 2539
x = double(x);

Error in ==> sym.sym>privformat at 2524
s = privformatscalar(x);

Error in ==> sym.sym>sym.subsref at 1364
[inds{k},refs{k}] = privformat(inds{k});


Can anyone help, or is there any way I can define the function for theta to use in the function for the slider, and make it able to differentiate it with respect to time (t)?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories