How to solve damped forced vibration analysis using ode45 ?
I am trying to solve equation of motion for a damped forced vibration analysis for a SDOF system. My input Force is function of time having random white noise. I am using ode45 to solve the problem. Here is my code.
% Main code
clear variables
close all
clc
t = 0:20; % Time duration
x = [1; 6]; % Initial conditions
[t, x] = ode45(@eqm,t,x); % ode45 command
Below is the function eqm
% Function
function dxdt = eqm(t, x)
F = 1:20 % For simplicity I have taken force as an array
m = 1; % mass
c = 1; % damping
k = 1; % stiffness
dxdt = [x(2); F/m – c/m*x(2) – k*x(1)];
end
After I run this code it shows error "Error using vertcat. Dimensions of arrays being concatenated are not consistent". I checked online but most of the examples contains only periodic functions of force such as F = sin(wt) but I didn’t find anything for random load. Any help will be greatly appreciated.I am trying to solve equation of motion for a damped forced vibration analysis for a SDOF system. My input Force is function of time having random white noise. I am using ode45 to solve the problem. Here is my code.
% Main code
clear variables
close all
clc
t = 0:20; % Time duration
x = [1; 6]; % Initial conditions
[t, x] = ode45(@eqm,t,x); % ode45 command
Below is the function eqm
% Function
function dxdt = eqm(t, x)
F = 1:20 % For simplicity I have taken force as an array
m = 1; % mass
c = 1; % damping
k = 1; % stiffness
dxdt = [x(2); F/m – c/m*x(2) – k*x(1)];
end
After I run this code it shows error "Error using vertcat. Dimensions of arrays being concatenated are not consistent". I checked online but most of the examples contains only periodic functions of force such as F = sin(wt) but I didn’t find anything for random load. Any help will be greatly appreciated. I am trying to solve equation of motion for a damped forced vibration analysis for a SDOF system. My input Force is function of time having random white noise. I am using ode45 to solve the problem. Here is my code.
% Main code
clear variables
close all
clc
t = 0:20; % Time duration
x = [1; 6]; % Initial conditions
[t, x] = ode45(@eqm,t,x); % ode45 command
Below is the function eqm
% Function
function dxdt = eqm(t, x)
F = 1:20 % For simplicity I have taken force as an array
m = 1; % mass
c = 1; % damping
k = 1; % stiffness
dxdt = [x(2); F/m – c/m*x(2) – k*x(1)];
end
After I run this code it shows error "Error using vertcat. Dimensions of arrays being concatenated are not consistent". I checked online but most of the examples contains only periodic functions of force such as F = sin(wt) but I didn’t find anything for random load. Any help will be greatly appreciated. ode45, differential equations MATLAB Answers — New Questions