필터 지우기
필터 지우기

Simple Undamped Forced Vibration Problem

조회 수: 5 (최근 30일)
bugatti79
bugatti79 2014년 8월 1일
댓글: bugatti79 2014년 8월 1일
I am trying to replicate a solution in Matlab for the following problem
x¨+k*x/m=Fo*sin*wo*t/m
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
x=A*sin(wn*t)+B*cos(wn*t)+(Fo*sin(wo*t)/k)/(1−(wo/wn)^2)
where the 3rd term is the particular solution assumed of the form xp=C*sin(wo*t). I am not sure how to implement this correctly in Matlab
Any ideas?
Thanks
if true
% code
end

답변 (1개)

Mischa Kim
Mischa Kim 2014년 8월 1일
bugatti79, your code looks fine. In other words, you correctly implemented the differential equation and, yes, MATLAB does return the correct solution: general plus particular.
  댓글 수: 3
Mischa Kim
Mischa Kim 2014년 8월 1일
If you solve the DE numerically (as you do right now) MATLAB returns numeric values. You could, of course, integrate the DE twice, once with F0=0 and then subtract the two solutions from each other. But again, you will only get numeric values.
I believe what you want is to go symbolic. E.g.
syms x(t) k m F0 w0
DxDt = diff(x);
D2xDt2 = diff(x,2);
% Define differential equation
my_DE = D2xDt2 + k*x/m == F0*sin(w0*t)/m;
% Set initial conditions
x0 = x(0) == 0.02;
Dx0 = DxDt(0) == 1;
% Solve differential equation and display
x_sol = dsolve(my_DE, x0, Dx0);
display(['x(t) = ',char(10),char(x_sol),char(10)])
pretty(x_sol)
Does that help?
bugatti79
bugatti79 2014년 8월 1일
Hi Mischa,
Just looking at the problem now. I get an error message stating
Error in ==> AlgebraicDE at 2
syms x(t) k m F0 w0

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by