Different Approach to solve ODE
古いコメントを表示
Hello all,
I am trying to solve an ODE but I am not sure if the approach using ode45 is right.
1st Approach:
% Quadratic damping Response
tspan = 0:1800;
y0 = [0;0];
[t,y] = ode45 (@forced,tspan,y0);
plot(t,y(:,1));
grid on
xlabel ('time(s)')
ylabel ('Displacement(m)')
title ('System Response')
hold on
% Linear Damping Response
f = 0.01; % Force (N)
c = 0.01; % Damping coefficient (N.s/m)
k = 20;
w = 2*pi; % frequency (rad/s)
m = 0.5; % Mass (Kg)
wn = sqrt(k/m); % Natural Frequency
cc = 2*m*wn; % Critical Damping
z = c/cc;
a = -(2*z*w*wn*f/m)/((wn^2 - w^2)^2 + (2*z*w*wn)^2);
b = ((wn^2 - w^2)*f/m)/((wn^2 - w^2)^2 + (2*z*w*wn)^2);
X = sqrt(a^2 + b^2);
fi = -atan(a/b);
x = X*sin(6.28*t - fi);
plot(t,x);
function yp = forced(t,y)
yp = [y(2);
0.01/0.5*cos(2*pi*t)-1/0.5*y(2)^2-20/0.5*y(1)];
end
2nd Approach
syms x(t)
Dx = diff(x);
ode = diff(x,t,2) == 0.01*cos(2*pi*t) - 2*(diff(x,t,1))^2 - 40*x;
xSol(t)= dsolve(ode);
This second approach gives me the warning that it is unable to find symbolic solution. I already have installed the symbolic toolbox but, still getting the same results.
Any help?
Thank you in Advance
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Numeric Solvers についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!