how can i plot this equation ??? please
2 views (last 30 days)
Show older comments
sihem chaib
on 15 Feb 2014
Commented: sihem chaib
on 15 Feb 2014
clear all
clc
%le 29/10/2013 à 23h00
%les géométries de la poutre
M=30; % masse de la poutre KG/ML??
EI=200*10^7;% Rigidité flexionnelle de la poutre N/m^2
%l=22;%m
%les caractéristiques du sol
c=0;% constante d'amortissement
k=0.2*10^8;% rigidité du sol N/m^2
v=5;%vitesse m/s de chargement
n1=5;%nombre des modes
%longueur de la poutre en m
l=(3*pi/2)*(4*EI/k)^0.25; %m;
%les conditions initiales
v_0=0;%m/s;vitesse initiale
T_0=0.01*10^-4;%m déplacement initial
t1=l/v;
for m=1:n1;
x=1:0.01:l+1;
phi(x,m)=sin((x-1)*pi*m/l);
t=1:0.01/v:t1;
beta=c/(2*M);
B=T_0;
w_d(m)=((((m^4)*(pi^4)*EI)/(M*(l^4)))+(k/M))^0.5; %pulsation propre
w_n(m)=((w_d(m)^2)-(beta^2))^0.5;% pseudo pulsation
A(m)=((v_0)+(B*beta))/w_n(m);
T(t,m)=(exp(-beta*(t-1)*(A(m)*sin((w_n(m))*(t-1))+B*cos((w_n(m))*(t-1)))));
ww(x,t,m)=phi(x,m)*T(t,m);%(sin(m*pi*(xx1(i)-1)/l))* T(j,m);%((exp(-beta*(tt1(j)-1)))*(A(m)*sin((w_n(m))*(tt1(j)-1))+B*cos((w_n(m))*(tt1(j)-1))));
end
x=1:0.01:l+1;
t=1:0.01/v:t1;
ww1(x,t)=0;
for m=1:n1;
ww1(x,t)=ww1(x,t)+ww(x,t,m);
end
plot (ww1(:,1),'B');
hold on
%remarque : se sont des ondes stationaires changent d'emplitudes mais ne
%changent pas de position.
2 Comments
Walter Roberson
on 15 Feb 2014
Edited: Walter Roberson
on 15 Feb 2014
Side note: you can replace
ww1(x,t)=0;
for m=1:n1;
ww1(x,t)=ww1(x,t)+ww(x,t,m);
end
with
ww1(x,t) = sum(ww(x,t,:));
Accepted Answer
Walter Roberson
on 15 Feb 2014
Your code has
t=1:0.01/v:t1;
ww1(x,t)=0;
so you are trying to use t as an index into an array. But t has values like 1.80 and floating point numbers cannot be used as indices.
Try
t=1:0.01/v:t1;
ww1(x, 1:length(t)) = 0;
Except, that is, that as I noted above you do not need to initialize ww1(x,t). So you can take the statement I gave
ww1(x,t) = sum(ww(x,t,:));
and replace it with
ww1(x,1:length(t)) = sum(ww(x,1:length(t),:),3);
0 Comments
More Answers (0)
See Also
Categories
Find more on Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!