matlab 运行错误,
来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/08/18 19:24:37
matlab 运行错误,
clear all;clcglobal p x
p=101325;
x0=[0.3 0.3 0.4];
[t,x]=ode45(@justice,[0:0.01:100],x0);
plot(x(:,1),x(:,2))
hold on
%function dxdt=justice(t,x)
global xtemp
x=x./sum(x);
xtemp=x;
T2=fzero(@sumy,300)
psat=antione(T2);
gamma=wilson(x,T2);
k=psat.*gamma./p
dxdt=-x+k'*x;
%function f=sumy(T)
global p xtemp
X=xtemp;
psat=antione(T);
gamma=wilson(X,T);
sumy=sum(X.*psat.*gamma./p);
f=1-abs(sumy);
%function psat=antione(T)
An=[13.31187 4068.457 139.572;10.14589 1936.010 5.291;9.81339 1669.898 -41.350];
for i=1:3
psat(i)=10^(An(i,1)-An(i,2)/(An(i,3)+T)); %压力的计算
end
%function gamma=wilson(x,T)
c=[0,0,0];
A=[0 478.6 1070.484;478.60 0 626.9;1070.484 626.90 0];
for k=1:3
for i=1:3
for j=1:3
c(k)=c(k)+(A(i,k)+A(j,k)-A(i,j))*x(i)*x(j);
end
end
gamma(k)=exp(c(k)/(2*T));
end
clear all;clcglobal p x
p=101325;
x0=[0.3 0.3 0.4];
[t,x]=ode45(@justice,[0:0.01:100],x0);
plot(x(:,1),x(:,2))
hold on
%function dxdt=justice(t,x)
global xtemp
x=x./sum(x);
xtemp=x;
T2=fzero(@sumy,300)
psat=antione(T2);
gamma=wilson(x,T2);
k=psat.*gamma./p
dxdt=-x+k'*x;
%function f=sumy(T)
global p xtemp
X=xtemp;
psat=antione(T);
gamma=wilson(X,T);
sumy=sum(X.*psat.*gamma./p);
f=1-abs(sumy);
%function psat=antione(T)
An=[13.31187 4068.457 139.572;10.14589 1936.010 5.291;9.81339 1669.898 -41.350];
for i=1:3
psat(i)=10^(An(i,1)-An(i,2)/(An(i,3)+T)); %压力的计算
end
%function gamma=wilson(x,T)
c=[0,0,0];
A=[0 478.6 1070.484;478.60 0 626.9;1070.484 626.90 0];
for k=1:3
for i=1:3
for j=1:3
c(k)=c(k)+(A(i,k)+A(j,k)-A(i,j))*x(i)*x(j);
end
end
gamma(k)=exp(c(k)/(2*T));
end
![matlab 运行错误,](/uploads/image/z/16419474-18-4.jpg?t=matlab+%E8%BF%90%E8%A1%8C%E9%94%99%E8%AF%AF%2C)
clear all;clcglobal p x
p=101325;
x0=[0.3 0.3 0.4];
[t,x]=ode45(@justice,[0:0.01:100],x0);
plot(x(:,1),x(:,2))
hold on
%function dxdt=justice(t,x)
global xtemp
x=x./sum(x);
xtemp=x;
T2=fzero(@sumy,300)
psat=antione(T2);
gamma=wilson(x,T2);
k=psat.*gamma./p
dxdt=-x+k'.*x; %此处已修改
%function f=sumy(T)
global p xtemp
X=xtemp;
psat=antione(T);
gamma=wilson(X,T);
sumy=sum(X‘.*psat.*gamma./p); %此处已修改
f=1-abs(sumy);
%function psat=antione(T)
An=[13.31187 4068.457 139.572;10.14589 1936.010 5.291;9.81339 1669.898 -41.350];
for i=1:3
psat(i)=10^(An(i,1)-An(i,2)/(An(i,3)+T)); %压力的计算
end
%function gamma=wilson(x,T)
c=[0,0,0];
A=[0 478.6 1070.484;478.60 0 626.9;1070.484 626.90 0];
for k=1:3
for i=1:3
for j=1:3
c(k)=c(k)+(A(i,k)+A(j,k)-A(i,j))*x(i)*x(j);
end
end
gamma(k)=exp(c(k)/(2*T));
end
测试通过.祝好
p=101325;
x0=[0.3 0.3 0.4];
[t,x]=ode45(@justice,[0:0.01:100],x0);
plot(x(:,1),x(:,2))
hold on
%function dxdt=justice(t,x)
global xtemp
x=x./sum(x);
xtemp=x;
T2=fzero(@sumy,300)
psat=antione(T2);
gamma=wilson(x,T2);
k=psat.*gamma./p
dxdt=-x+k'.*x; %此处已修改
%function f=sumy(T)
global p xtemp
X=xtemp;
psat=antione(T);
gamma=wilson(X,T);
sumy=sum(X‘.*psat.*gamma./p); %此处已修改
f=1-abs(sumy);
%function psat=antione(T)
An=[13.31187 4068.457 139.572;10.14589 1936.010 5.291;9.81339 1669.898 -41.350];
for i=1:3
psat(i)=10^(An(i,1)-An(i,2)/(An(i,3)+T)); %压力的计算
end
%function gamma=wilson(x,T)
c=[0,0,0];
A=[0 478.6 1070.484;478.60 0 626.9;1070.484 626.90 0];
for k=1:3
for i=1:3
for j=1:3
c(k)=c(k)+(A(i,k)+A(j,k)-A(i,j))*x(i)*x(j);
end
end
gamma(k)=exp(c(k)/(2*T));
end
测试通过.祝好