Hi Folks,(adsbygoogle = window.adsbygoogle || []).push({});

I am trying to replicate a solution in Matlab for the following problem ##\displaystyle \ddot x + \frac{k}{m}x = \frac{F_o}{m} \sin w_ot##

using 2 first order linear differential equations in Matlab as shown below

tspan=[0 4];

y0=[.02;1]; %Initial Conditions for y(1)=x and y(2)= x dot

[t,y]=ode45(@forced1,tspan,y0); %Calls forced1.m

plot(t,y(:,2)); %y(:,1) represents the displacement and y(:,2) the velocity

grid on

xlabel('time')

ylabel('Displacement')

title('Displacement Vs Time')

hold on;

function yp = forced1(t,y)

m=20;

k=800;

f=8;

w=8;

yp = [y(2);(((f/m)*sin(w*t))-((k/m)*y(1)))];

The problem is I dont know whether Matlab considers both the complementary and particular solution. THe theoretical solution is given as

##\displaystyle x=A \sin w_nt +B \cos w_nt+ \frac{\frac{F_o}{k}}{1-(\frac{w_o}{w_n})^2} \sin w_ot##

where the 3rd term is the particular solution assumed of the form ##x_p=C \sin w_o t##. I am not sure how to implement this correctly in Matlab

Any ideas?

Thanks

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# [MATLAB] Simple Undamped Forced Vibration Problem

Tags:

Loading...

Similar Threads - MATLAB Simple Undamped | Date |
---|---|

Simple MATLAB loop | Oct 30, 2015 |

Coding up a simple geometric algebra in MATLAB | Oct 12, 2015 |

Having difficult time trying to plot a simple trajecory | May 30, 2014 |

A simple symbolic expression in Matlab | Aug 2, 2013 |

Help needed in MATLAB , Please ( Simple question ) | Sep 19, 2012 |

**Physics Forums - The Fusion of Science and Community**