response amplitude in my ode45

5 vues (au cours des 30 derniers jours)
Donghun Lee
Donghun Lee le 7 Août 2020
clc,clear all
k_s = 26400;
m = 483; %Mass
f_n = sqrt(k_s/m)/(2*pi); %Natural frequency in Hz
%%
Om_array = linspace(0,10*pi, 100); %Excitation frequency
A_array = linspace(0.025,0.025, 100); %Excitation amplitude
[om_array, a_array] = meshgrid(Om_array, A_array);
Response_amp = zeros(size(Om_array));
T = 150;
x0 = [0,0];
for i=1:numel(Om_array)
for j=1:numel(A_array)
Om = om_array(i,j);
A = a_array(i,j);
%k_s = -(k_l*(l-d))/(4*d); %Spring stiffness
f = @(t,x) [ x(2); -( k_s*(x(1)- ...
(A*sin(Om*t))) )/ m ];
[t, x] = ode45(f,[100,T],x0);
Response_amp(i,j) = (max(x(:,1)) - min(x(:,1)))/2;
%Response_amp(i,j) = (max(x(:,1)))/8;
% xval(i) = Om/(2*pi) ;
end
end
view([30 63]);
grid on
mesh(om_array/(2*pi),a_array,Response_amp,'edgecolor', 'k') ;
xlabel('Frequency (Hz)')
ylabel('Excitation Amplitude (m)')
zlabel('Response Amplitude (m)')
% a = colorbar;
% a.Label.String = 'Response Amplitude (m)';
set(gca,'FontSize',17)
hold on
Om_array = linspace(0,10*pi, 100); %Excitation Amplitude
A_array = linspace(0.2,0.2, 100);
[om_array, a_array] = meshgrid(Om_array, A_array);
Response_amp = zeros(size(Om_array));
T = 150;
x0 = [0,0];
for i=1:numel(Om_array)
for j=1:numel(A_array)
Om = om_array(i,j);
A = a_array(i,j);
%k_s = -(k_l*(l-d))/(4*d); %Spring stiffness
f = @(t,x) [ x(2); -( k_s*(x(1)- ...
(A*sin(Om*t))) )/ m ];
[t, x] = ode45(f,[100,T],x0);
Response_amp(i,j) = (max(x(:,1)) - min(x(:,1)))/2;
%Response_amp(i,j) = (max(x(:,1)))/8;
% xval(i) = Om/(2*pi) ;
end
end
view([30 63]);
grid on
mesh(om_array/(2*pi),a_array,Response_amp,'edgecolor', 'k') ;
xlabel('Frequency (Hz)')
ylabel('Excitation Amplitude (m)')
zlabel('Response Amplitude (m)')
% a = colorbar;
% a.Label.String = 'Response Amplitude (m)';
set(gca,'FontSize',17)
hold off
%%
figure(2)
A = 0.2;
k_s = 26400;
nf = 1.1767; %natural frequency
T = 150;
f = @(t,x) [ x(2); -( k_s*(x(1)- ...
(A*sin(nf*t))) )/ m ];
[t, x] = ode45(f,[100,T],x0);
plot(t,x)
xlabel('time (s)')
ylabel('Response Amplitude (m)')
Hi, this is my ode45 function. The frequency response function is represented in figure 1 as below,
As you can see, if you see the graph at the back, it shows 15.52m of response amplitude.
However, if we see the figure 2,
it shows 1.714m of the response amplitude.
From my understanding, they should have the same value. I think there's something wrong with 15.52m of response amplitude because it is too high. However, I'm not sure what is wrong with my code.
Can anyone help me out on this please?

Réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by