Matlab and mechanics (mostly physics)

柔情痞子 提交于 2019-12-24 03:04:26

问题


I am trying to solve a mechanics problem regarding momentum of two shafts. I have never had a class an mechanics before, so i don't know how to approach this problem.

Given: equations:

• J1*dw1/dt + Td(w12)+Ts(phi12) = T1;
• J2*dw2/dt - Td(w12) -Ts(phi12) = T2;
where w1 = dphi1/dt, 
    w2 = dphi2/dt, 
    phi12 = phi1 - phi2
    w12 = w1 - w2
    Td(w12) = c12 * w12
    Ts(phi12) = ks * phi12
c12 and ks are some 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

`

The goal is to plot the function Tsmax/T0 = f(J1/(J1+J2)) Any guidance would be appreciated.

I tried solving the equation in simulink, here's what I did so far

My code in matlab

T0 = 1;
T2 = 0;
J1 = 5;
J2 = 10-J1;
wn=100;
Jeq=J1.*J2/(J1+J2);
ckr = 2.*Jeq*wn;
ks = (wn^2)*Jeq;
c12=0;
J1s = 1;
length(J1)
a2 = 0 :J1;

for c=1:J1
    J1s = a2(c);
    sim('model');
    a = J1s/(J1s+J2);
    plot(Ts,a)
    hold all
end
grid on

which really does nothing close to what is expected. To my information the curve should be something like f(x) = -1x+b.


回答1:


I think the problem is that in each of your iterations, you are not re-calculating J2 and Jeq. Now, your model is parameterised with J1, J2 and Jz so these are the values you need to update with each iteration. Something like:

a2 = 0:J1; % do you really want 0 inertia?
Tsmax = zeros(size(a2));

for ii=1:length(a2)
    J1 = a2(ii); % Using J1 as model is parameterised with J1;
    J2 = 10 - J1; % New value of J2
    Jz = J1*J2/(J1+J2); % New value of Jz
    sim('model'); % ks and c12 do not change with each iteration
    Tsmax(ii) = max(Ts); % get max value of Ts        
end

% Plot Tsmax as a function of Jeq
Jeq = (a2.*(10-a2))/10;
plot(Jeq,Tsmax)
grid on


来源:https://stackoverflow.com/questions/29880545/matlab-and-mechanics-mostly-physics

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!