i=0;
Pres=[160,260,360,];
%orden de los componentes H2,N2,CH4,Ar,NH3
x_in=[62.5,20.8,9.3,3.7,3.7;60.1,20,12.5,3.7,3.7;58.6,19.5,12.5,5.7,3.7];

N_in=[];
for a=1:3
   for j=1:5
   N_in(j)=x_in(a,j)/x_in(a,2);
end
Total_in=sum(N_in,2);

%   for cont=1:3
cont=1;
for x=0:0.1:0.9

P=Pres(cont);

N_out=[];
N_out(2)=N_in(2)-x;
N_out(1)=N_in(1)-3*x;
N_out(5)=N_in(5)+2*x;
N_out(3)=N_in(3);
N_out(4)=N_in(4);
Total_out=Total_in-2*x;

Kp=sqrt((1/P^2)*(N_out(5)/Total_out)^2/((N_out(1)/Total_out)^3*(N_out(2)/Total_out)));

T=fsolve('temp',800,[],[],Kp);

i=i+1;
Tstore(i)=T-273.14;
xstore(i)=x;

end
end
%end

plot(Tstore(1:10),xstore(1:10),Tstore(11:20),xstore(11:20),Tstore(21:30),xstore(21:30))
xlabel('temperatura ºC');
ylabel('conversion %');
legend('menos','medio','mas')