temporal discretisation and time step value
Mostrar comentarios más antiguos
Hello,
I know I need to add temporal discretisation defined by the value dt (delta t) to my code. I should have it as an input parameter. I know which value to add, just not how to do it in matlab. I haven't found a way to do it yet so a little help would be helpful ! (I'll add a plot in the code when I've figured out how to do the rest)
Thx a lot.
clc;clear;
X= input ('distance X=');
a=9*X^2;
b=-183*X;
c=1000;
F= (a+b+c); %Fpeak
a1=20;
b1=-0.12*X^2;
c1=4.2*X;
Td= (a1+b1+c1); %loading duration td
disp('z(t) equation');
%have delta t as input, should vary depending on k and m
dt=0.0003; %this is the delta t
tmax=100; %max time, arbitrary value for now
t=0:dt:tmax;% part i'm struggling with
M= input ('M kg=');
K=input('K in MN/m=');
w= sqrt(K/M);
for t= 1:length(t) % <- dunno if this is right
if t <= Td
z(t)=(F/K)*(1-cos(w*t))+(F/(K*Td))*((sin(w*t)/w)-t);
else
z(t)=(F/(K*w*Td))*(sin(w*t)-sin(w*(t-Td)))-(F/K)*cos(w*t);
end
end
T= 2*pi/w; %blast wall's natural period
disp ('zt')
disp (z(t))
disp ('T in seconds');
disp (T)
disp ('displacement must be >100mm')
%plot(z(t));
1 comentario
Anthony Gurunian
el 7 de En. de 2021
if you know dt as a function of M and K then you have to make a function which returns dt after the users inputs M and K.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!