Info
此问题已关闭。 请重新打开它进行编辑或回答。
I run the below program, i got RESHAPE ERROR, Please rectify that error and also give the correct the program
2 次查看(过去 30 天)
显示 更早的评论
clc; clear; format short syms x a b c d C1 t C2 C3 f1 l1 e1 R1 S A1 f2 e2 h1 h2 Rd f3 f4 e4 e3 l2 l3 k3 l4 k4 A=1; A1=1; Pr=1; Sc=1; Df=0.2; Sr=0.2; S=-0.5; c=0.5; K=0.1; Rd=1; h1=-0.9; h2=-0.6; f1(1)=1-exp(-t); l1(1)=1-exp(-t); f2(1)=c*(1-exp(-t)); l2(1)=c*(1-exp(-t)); f3(1)=exp(-t); l3(1)=exp(-t); f4(1)=exp(-t); l4(1)=exp(-t); g(1)=0; e(1)=0; e1(1)=0; e2(1)=0; e3(1)=0; e4(1)=0; e5(1)=0; e6(1)=0; z(1)=0; n=21; for m=2:n i=m-1; a1(i)=diff(f1(i),'t'); b1(i)=diff(a1(i),'t'); c1(i)=diff(b1(i),'t'); d1(i)=diff(c1(i),'t'); a2(i)=diff(f2(i),'t'); b2(i)=diff(a2(i),'t'); c2(i)=diff(b2(i),'t'); d2(i)=diff(c2(i),'t'); a3(i)=diff(f3(i),'t'); b3(i)=diff(a3(i),'t'); c3(i)=diff(b3(i),'t'); a4(i)=diff(f4(i),'t'); b4(i)=diff(a4(i),'t'); c4(i)=diff(b4(i),'t'); for j=1:m-1
e1(j+1)=(f1(m-j)+f2(m-j))*b1(j)-a1(m-j)*a1(j)+K*((f1(m-j)+f2(m-j))*d1(j)+(b1(m-j)-b2(m-j))*b1(j)-2*(a1(m-j)+a2(m-j))*c1(j));
e1(j+1)=e1(j+1)+e1(j);
e2(j+1)=(f1(m-j)+f2(m-j))*b2(j)-a2(m-j)*a2(j)+K*((f1(m-j)+f2(m-j))*d2(j)+(b2(m-j)-b1(m-j))*b2(j)-2*(a1(m-j)+a2(m-j))*c2(j));
e2(j+1)=e2(j+1)+e2(j);
e3(j+1)=Sc*(f1(m-j)+f2(m-j))*a3(j);
e3(j+1)=e3(j+1)+e3(j);
e4(j+1)=Pr*(f1(m-j)+f2(m-j))*a4(j);
e4(j+1)=e4(j+1)+e4(j);
j=j+1;
end
g(m)=1; R1(m-1)=c1(m-1)+e1(m)-A1*((t/2)*b1(m-1)+a1(m-1))-K*A1*((t/2)*d1(m-1)+2*c1(m-1));
R2(m-1)=c2(m-1)+e2(m)-A1*((t/2)*b2(m-1)+a2(m-1))-K*A1*((t/2)*d2(m-1)+2*c2(m-1));
R3(m-1)=b3(m-1)+e3(m)-Sc*A*f3(m-1)-Sc*A1*(t/2)*a3(m-1)+Sc*Sr*b4(m-1);
R4(m-1)=b4(m-1)*(1+(4/(3*Rd)))+e4(m)-Pr*A1*(t/2)*a4(m-1)+Pr*S*f4(m-1)+Pr*Df*b3(m-1);
syms C1 C2 C3 C4 C5 C6 C7 C8 C9 C11 C10 C11 C12 C13 C14
f1(m)=h1*int(exp(t)*int(exp(-2*t)*int(exp(t)*R1(m-1))))+g(m-1)*f1(m-1);
f2(m)=h1*int(exp(t)*int(exp(-2*t)*int(exp(t)*R2(m-1))))+g(m-1)*f2(m-1);
f3(m)=h2*(exp(t)*int(exp(-2*t)*int(exp(t)*R3(m-1))))+g(m-1)*f3(m-1);
f4(m)=h2*(exp(t)*int(exp(-2*t)*int(exp(t)*R4(m-1))))+g(m-1)*f4(m-1);
o1(m)=C3*exp(-t)+C2*exp(t)+C1;
y1(m)=diff(f1(m),t);
C3=subs(y1(m),t,0);
C2=0;
C1=-C3-subs(f1(m),t,0);
f1(m)=f1(m)+ subs(o1(m));
o2(m)=C6*exp(-t)+C5*exp(t)+C4;
y2(m)=diff(f2(m),t);
C6=subs(y2(m),t,0);
C5=0;
C4=-C6-subs(f2(m),t,0);
f2(m)=f2(m)+ subs(o2(m));
o3(m)=C8*exp(-t)+C7*exp(t);
C7=0;
C8=-subs(f3(m),t,0);
f3(m)=f3(m)+ subs(o3(m));
o4(m)=C10*exp(-t)+C9*exp(t);
C9=0; C10=-subs(f4(m),t,0);
f4(m)=f4(m)+ subs(o4(m));
l1(m)=f1(m)+l1(m-1);
k1=l1(m);
l2(m)=f2(m)+l2(m-1);
k2=l2(m);
l3(m)=f3(m)+l3(m-1);
k3=l3(m);
l4(m)=f4(m)+l4(m-1);
k4=l4(m);
m=m+1;
end k1; k2; k3; k4; p1=diff(k1,t,2); p2=diff(k2,t,2); p3=diff(k3,t,1); p4=diff(k4,t,1); t=0; p7=subs(p1) p8=subs(p2) p9=subs(p3) p10=subs(p4)
2 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!