clear allclose allsyms sA=[10*s^2+10*s+400 0 -200;0 20*s^2+10*s+400 -10*s-200;-200 -10*s-200 30*s^2+10*s+400];B=[0;0;1];sol=inv(A)*Bm1=(2*(2*s^2 + s + 40))/(6*s^6 + 11*s^5 + 445*s^4 + 440*s^3 + 8440*s^2 + 2400*s + 32000)m2=((s + 20)*(s^2 + s + 40))/(10*(6*s^6 + 11*s^5 + 445*s^4 + 440*s^3 + 8440*s^2 + 2400*s + 32000))m31=((2*s^2 + s + 40)*(s^2 + s + 40))/(10*(6*s^6 + 11*s^5 + 445*s^4 + 440*s^3 + 8440*s^2 + 2400*s + 32000))m3=m1-m31h=10/sx1s=(m1*h)x2s=(m2*h)x3s=(m3*h)[nums,dens]=numden(m1)num=sym2poly(nums)den=sym2poly(dens)m1s=tf(num,den)m1s=minreal(m1s)[nums,dens]=numden(m2)num2=sym2poly(nums)den2=sym2poly(dens)m2s=tf(num,den)m2s=minreal(m2s)[nums,dens]=numden(m3)num3=sym2poly(nums)den3=sym2poly(dens)m3s=tf(num,den)m3s=minreal(m3s)[x1 t]=step(m1s,100)[x2 t2]=step(m2s,100)[x3 t3]=step(m3s,100) figure(4)subplot(311)plot(t,x1)subplot(312)t=0:0.001:10u=10lsim(m1s,u*ones(length(t),1),t)subplot(313)impulse(m1s)figure(5)subplot(311)plot(t2,x2)subplot(312)lsim(m2s,u*ones(length(t),1),t)subplot(313)impulse(m2s)figure(6)subplot(311)plot(t3,x3)subplot(312)lsim(m3s,u*ones(length(t),1),t)plot(t,y3)subplot(313)impulse(m3s)
MATLAB: Please help why is the lsim not plotting
dynamics modelingmechanical engineer
Related Question
- I want from user to give two equation then i want to devition this two equation but it errors.
- How to get the transfer function G(s) = (X2(s)-W(s))/W(s)
- Extract num and den in symbolic expression.
- How to differentiate several symbolic functions
- How to convert a transfer fuction (tf class) to a symbolic equation (sym)
Best Answer