۱۳۹۴/۰۱/۲۸, ۰۴:۲۷ ب.ظ
خوشبختانه بعد از جندساعت تلاش و کمک از برنامه ها و موضوعات ارایه شده کد متلب نوشته شد.
معادله موج:
syms dr;syms cr;syms x;tempU=0;syms x;syms t;tempcr=0;tempdr=0;
L=input('please enter the length of your cord: ');
a=input('and now,let the computer know the value of a in your equation\n a is:');
b=input('and now,let the computer know the value of b in your equation\n b is:');
if (a<=L<=b);
f1=input('and now,let the computer know the value of f1 in your equation\n f1 is:');
end
d=input('and now,let the computer know the value of d in your equation\n d is:');
if (b<=L<=d);
f2=input('and now,let the computer know the value of f2 in your equation\n f2 is:');
end;
c=input('and now,let the computer know the value of c in your equation\n c is:');
g1=input('and now,let the computer know the value of g1 in your equation\n g1 is:');
T=1;
for r=drange(1:1:10)
j=r*pi/L;
k=r*pi*c/L;
F=sin(j*x);
cr=(2/L)*((int(F*f1,'x',a,b))+(int(F*f2,'x',b,d)));
tempcr=tempcr+cr;
G=sin(j*x);
dr=(2/(r*c*pi))*(int(G*g1,'x',0,L));
tempdr=tempdr+dr;
u=(cr*cos(k*T)+dr*sin(k*T))*sin(j*x);
disp(u);
tempU=tempU+u;
ezplot(tempU,[0,L]);
end
معادله موج:
syms dr;syms cr;syms x;tempU=0;syms x;syms t;tempcr=0;tempdr=0;
L=input('please enter the length of your cord: ');
a=input('and now,let the computer know the value of a in your equation\n a is:');
b=input('and now,let the computer know the value of b in your equation\n b is:');
if (a<=L<=b);
f1=input('and now,let the computer know the value of f1 in your equation\n f1 is:');
end
d=input('and now,let the computer know the value of d in your equation\n d is:');
if (b<=L<=d);
f2=input('and now,let the computer know the value of f2 in your equation\n f2 is:');
end;
c=input('and now,let the computer know the value of c in your equation\n c is:');
g1=input('and now,let the computer know the value of g1 in your equation\n g1 is:');
T=1;
for r=drange(1:1:10)
j=r*pi/L;
k=r*pi*c/L;
F=sin(j*x);
cr=(2/L)*((int(F*f1,'x',a,b))+(int(F*f2,'x',b,d)));
tempcr=tempcr+cr;
G=sin(j*x);
dr=(2/(r*c*pi))*(int(G*g1,'x',0,L));
tempdr=tempdr+dr;
u=(cr*cos(k*T)+dr*sin(k*T))*sin(j*x);
disp(u);
tempU=tempU+u;
ezplot(tempU,[0,L]);
end