"Not enough input arguments, Error in my_ode_without_tld_1 (line 24) F = interp1(tdata,ydata)" why this error is showing?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
function dydt = my_ode_without_tld_1(t,y,tdata,ydata)
% tspan = i; %% Time span
%% Initial inputs
m1 = 8500; %% mass of the structure(kg)
k1 = 15; %% stiffness of the structure(N/m)
c1 = 5; %% damping of the structure(Ns/m)
A = 0.005; %% Amplitude of ground displacement(m)
f = 0.8671; %% Input frequencycy(Hz)
fs = 0.314465; %% Frequency of structure(Hz)
n = 1; %% Tuning ratio
%% define frequency
w1 = 2*pi*fs; %% frequency of structure(rad/sec)
%% define damping ratio of structure
r1 = 0.01;
%% define ground acceleration
ugdd = -A*(2*pi*f)^2*sin(2*pi*f*t);
F = interp1(tdata,ydata);
%% Equation to solve
dydt = [y(2) -ugdd-(2*r1*w1*y(2))-((w1)^2*y(1))+(F/m1)].';
clc;
clear all;
%% To run mass spring damper system
i = 0.1:0.1:30;
y = [0 0];
F = load('shear force.dat')';
%% Solve using ode45
[tsol,ysol] = ode45(@(t,y)my_ode_without_tld_1(t,y), i, y);
%% plotting
plot(tsol,ysol(:,1))
xlabel('time(sec)')
ylabel('displacement(m)')
grid on
title('Displacement response of structure')
0 comentarios
Respuestas (1)
Torsten
el 14 de Mayo de 2022
Editada: Torsten
el 14 de Mayo de 2022
If F has the same number of elements as i, the following should work:
i = 0.1:0.1:30;
y0 = [0 0];
F = load('shear force.dat')';
%% Solve using ode45
[tsol,ysol] = ode45(@(t,y)my_ode_without_tld_1(t,y,i,F), [0.1 30], y0);
%% plotting
plot(tsol,ysol(:,1))
xlabel('time(sec)')
ylabel('displacement(m)')
grid on
title('Displacement response of structure')
function dydt = my_ode_without_tld_1(t,y,tdata,ydata)
% tspan = i; %% Time span
%% Initial inputs
m1 = 8500; %% mass of the structure(kg)
k1 = 15; %% stiffness of the structure(N/m)
c1 = 5; %% damping of the structure(Ns/m)
A = 0.005; %% Amplitude of ground displacement(m)
f = 0.8671; %% Input frequencycy(Hz)
fs = 0.314465; %% Frequency of structure(Hz)
n = 1; %% Tuning ratio
%% define frequency
w1 = 2*pi*fs; %% frequency of structure(rad/sec)
%% define damping ratio of structure
r1 = 0.01;
%% define ground acceleration
ugdd = -A*(2*pi*f)^2*sin(2*pi*f*t);
F = interp1(tdata,ydata,t);
%% Equation to solve
dydt = [y(2) -ugdd-(2*r1*w1*y(2))-((w1)^2*y(1))+(F/m1)].';
end
Ver también
Categorías
Más información sobre Partial Differential Equation Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!