• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Apr 18th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. r= 3.2
2.  s= 0.03
3.  f= 0.8
4. %% Find stationary states
5. syms xi
6. eqn = -(r^2 * (xi-1)*((xi/2)-1)+1+(s/(1-xi)))*xi + f ;
7. %eqn2= -(r^2 * (xi-1)*((xi/2)-1)*(1-xi)+(1-xi)+(s))*xi+(f*(1-xi));
8.
9. f1 = matlabFunction(expand(eqn))
10.
11. root1=fzero(f1,[-4, 0.999999999])
12. root2=fzero(f1,[1.0000001, 4])
13.
14.
15. %% Solve ODE
16. omega = 0.01;
17. T = pi/omega;
18.
19. t_start = 0;
20. t_end = T;
21. time_span = t_start:0.01:t_end;
22.
23. xi0 = [0 0];
24.
25. [t,xi] = ode45(@odefun, time_span,xi0);
26. plot(t,xi);
27. hold on
28. plot (t, 3*sin(omega*t));
29. ylim([0,3.5])
30. legend('Displacement','Force','location','NorthEast')
31. title('Displacement vs Time')
32. xlabel('Time, tau [sec]')
33. ylabel('Displacement, \xi')
34. yyaxis right
35. ylabel ('Force F/F0')
36. ylim([0,3.5])
37. function xidot = odefun(t,xi)
38. xidot = -((3.2^2).*(xi-1).*(0.5*xi-1).*xi+xi+(xi.*0.03)./(1-xi))+3*sin(0.01*t);
39. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top