force input in ode
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Bhanu Pratap Akherya
il 24 Ago 2021
Modificato: darova
il 29 Ago 2021
i have a set of values for the force term "F" (in the equation my"+cy'+ky=F) saved in an excel file which i have recalled using:
F=xlsread('l&d.xlsx','O1:O300');
My main code looks something like:
y0=initial conditions
[tsol ysol]=ode15s('beam_function',[1:dt:T],y0);
plot(tsol,ysol);
whereas, my function code looks something like:
function [dy]=beam_function(t,y)
dy=[y(1:u-1);
inv(M)*(F-K*y(u:end)-C*y(1:u-1))]
The problem is that i want to recall each value of F at different time steps but i dont know how to do that, can anyone guide me?
Note: F here is not time dependent rather it has been taken from results obtained from a simulation software. Then what should be my approach?
0 Commenti
Risposta accettata
darova
il 24 Ago 2021
for i = 1:length(F)
[t,y] = ode45(@(t,y)beam_function(t,y,F(i)),...)
end
function dy = beam_funciton(t,y,F)
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!