Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rstanu6E = function(t, x, a){
- u = 1
- dx1=(1/20)*u - (1/20)*x[2]
- dx2=(3/20)*u + x[1] - (9/20)*x[2]
- list(c(dx1,dx2))
- }
- rstanu6Esin = function (t, x, a){
- u=sin(0.5*t)
- dx1=u-x[2]/20
- dx2=9*u-((9*x[2])/20)+x[1]
- list(c(dx1,dx2))
- }
- rstanu6E = function(t, x, a){
- u = 1
- dx1=(1/20)*u - (1/20)*x[2]
- dx2=(3/20)*u + x[1] - (9/20)*x[2]
- list(c(dx1,dx2))
- };
- rstanu6Esin025t = function (t, x, a){
- u=0.025*t
- dx1=(1/20)*u - (1/20)*x[2]
- dx2=(3/20)*u + x[1] - (9/20)*x[2]
- list(c(dx1,dx2))
- }
- rstanu6Esin = function (t, x, a){
- u=sin(0.5*t)
- dx1=(1/20)*u - (1/20)*x[2]
- dx2=(3/20)*u + x[1] - (9/20)*x[2]
- list(c(dx1,dx2))
- }
- eksp1 = function(x0){
- t = seq(0, 10, 0.01)
- out1 = ode(x0, t, rstanu6E, NULL)
- out2 = ode(x0, t, rstanu6Esin025t, NULL)
- out3 = ode(x0, t, rstanu6Esin, NULL)
- par(mfrow=c(2,2))
- y1 = out1[,3]
- y2 = out2[,3]
- y3 = out3[,3]
- plot(t,y1,type='l',col='red',xlab='t',ylab='y',main='wykres y(t) u = 1')
- lines(t,y2,type='l',col='blue',xlab='t',ylab='y',main='wykres y(t) u = 0,025t')
- lines(t,y3,type='l',col='green',xlab='t',ylab='y',main='wykres y(t) u = sin(0,5t)')
- #plot(out1[,2],out1[,3],type='l',col='blue',xlab='x1',ylab='x2',
- # main='portret fazowy')
- }
- eksp1(c(0,0))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement