MATLAB and mechanics (physics mostly) [part II] -


resume form part 1

basic scheme representing system: system

we assume coupling of 2 shafts done clutch

equations:

• j1*dw1/dt + td(w12)+ts(phi12) = t1; • j2*dw2/dt - td(w12) -ts(phi12) = t2; w1 = dphi1/dt,      w2 = dphi2/dt,      phi12 = phi1 - phi2     w12 = w1 - w2     td(w12) = c12 * w12     ts(phi12) = ks * phi12 c12 , ks coefficients • dphi12/dt = w12 • dw12/dt = t1/j1 - t2/j2 - td(w12)/jeq - ts(phi12)/jeq  ccr = 2*jeq*wn wn = sqrt(ks/jeq) jeq = (j1*j2)/(j1+j2) t1(t) = t0*1(t), t0 = 1 t2(t) = 0 j1+j2 = 10 wn = 100 rad/s c12 = 0 ts(phi12) = ks*phi12 

my second task plot how nonlinear clutch affects rotational inertia.

given :

t1(t) = t0*1(t), t0 = 1, t2(t) = 0, j1 = j2 = 5, c12 = 0, wn = 100, ts(phi12) = k1*phi12 + k2*(phi12)^3 k20 = 10e14, k2 = [10e-6 10e-5 10e-4 10e-3 10e-2 10e-1 10e0 10e1 10e2 10e3 10e4] 

i need plot tsmax/t0 = f(log(k2/k20));

so far progress is:

matlab code

t2 = 0; j1 = 5; j2 = j1; wn = 100; jz = j1.*j2/(j1+j2); ckr = 2.*jz*wn; ks = (wn^2)*jz; c12 = 0; k20 = 10e14; k2 = [10e-6 10e-5 10e-4 10e-3 10e-2 10e-1 10e0 10e1 10e2 10e3 10e4]; tsmax = zeros(size(k2)); k2a = 0; plpl = zeros(size(k2)); k1 = 1; sim ('model_2');  ii=1:length(k2)     k2a = k2(ii);     sim ('model_2');     tsmax(ii) = max(ts);     plpl(ii) = log(k2a/k20); end figure()     plot(plpl,tsmax)      grid on 

which yields

matlab_plot_1

and simulink model:

simulink

well, i'm kind of sure plot not should like.

some points/suggestions:

  • it seems parameterise simulink model k2a (unless can't see screenshot), it's not defined anywhere. define k2a in code, matlab case-sensitive it's not same as k2a.
  • your fcn1 block doesn't anything, can rid of it.

apart that, don't see wrong have done, , don't know plot should like, can't more i'm afraid.

edit:

i think that's plot supposed like. tried in octave, using matlab code & ode solver (no simulink) logspace have 50 data points logarithmically space between 10^(-6) , 10^4, , got similar.

enter image description here

i think hitting numerical stiffness issues larger values of k2 suggest using ode15s , max step size of 1e-4. may take bit longer run, might avoid numerical issues when system numerically stiff.