- #1
tanma_amnat
- 3
- 0
Homework Statement
how can i solve this problem by MATLAB?
pls help me
A (d4y/dx4) - B(d2y/dt2) = Cy
A=E*I
B=p*sin(w*t)
c=p*w2
conditions are
1.at x=0, dy/dx=0
2.at x=0,y=0
3.at x=L d2y/dx2=0
4. at x=L d3y/dx3=p (p is a function of t here)
x=0 and x=L are the two boundaries
pls tell me how can i slove it in MATLAB
Homework Equations
conditions are
1.at x=0, dy/dx=0
2.at x=0,y=0
3.at x=L d2y/dx2=0
4. at x=L d3y/dx3=p (p is a function of t here)
x=0 and x=L are the two boundaries
The Attempt at a Solution
i tried to solve it this way but not sure wheather it was right
...............
format long;
clc;
clear all;
m=10;
n=100;
l=.5;
time=input('t = ');
h=l/m;
k=time/n;
z=h/k;
r=m-1;
d=.05;
w=.1;
q=1;
p=1000;
E=207e9;
I=(3.1416*d^4)/64;
tt=[k:k:time];
T=(p*sin(w*tt(1,)*(1/k^2);
A=E*I*k^2/h^4;
C=p*w^2*k^2;
a=zeros(n*r);
b=zeros(n*r,1);
b(:,1)=q;
i=1;t=1;
for e=1:r
if i==1
a(e,i)=A-C;
a(e,i+1)=-4*A;
a(e,i+2)=6*A;
a(e,i+3)=-4*A;
a(e,i+4)=A;
a(e,r+i)=-T(t);
a(e,2*r+i)=2*T(t);
a(e,3*r+i)=-T(t);
elseif i==r
a(e,i)=A-C;
a(e,i-1)=-4*A;
a(e,i-2)=6*A;
a(e,i-3)=-4*A;
a(e,i-4)=A;
a(e,r+i)=-T(t);
a(e,2*r+i)=2*T(t);
a(e,3*r+i)=T(t);
else
a(e,i)=6*A-C;
a(e,i+1)=-4*A;
if (i+2)<=r
a(e,i+2)=A;
end
a(e,i-1)=-4*A;
if (i-2)>0
a(e,i-2)=A;
end
a(e,r+i)=-T(t);
a(e,2*r+i)=2*T(t);
a(e,3*r+i)=-T(t);
end
i=i+1;
end
s=0;i=1;t=2;
for e=(r+1):((n*r)-r)
if i==1
a(e,(t-1)*r+i)=A+2*T(t)-C;
a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=A;
end
a(e,(t-2)*r+i)=-T(t);
a(e,(t-3)*r+i)=2*T(t);
a(e,(t-4)*r+i)=-T(t);
end
i=i+1;
end
x=a\b;
v=zeros(n,r);
y=1;
for i=1:r
for j=1:n
v(i,j)=x(y);
y=y+1;
end
end
v;
%plot(v)
plot(rot90(v))
............
i could use only two conditions
1.at x=0, dy/dx=0
2.at x=0,y=0
seeking your advice