4 views (last 30 days)

Known:

Kp(1)=a;

Then:

x = roots([Kp-1 7.56*Kp -18.12*Kp 9.56*Kp]); (we only need 0<x<1).

T = roots([-0.001273*x+0.00365 0.544*x+44.3191 283338.4*x-407295]);

mu_CO2 = -394088+44.3191*(T-298-T*ln(T/298))-0.0073/2*(T-298)^2-213.984*T;

mu_CO = -110700+29.6127*(T-298-T*ln(T/298))-0.00301/2*(T-298)^2-197.81*T;

mu_O2 = 30.5041*(T-298-T*ln(T/298))-0.00349/2*(T-298)^2-205.31*T;

Kp_new = exp(-(mu_O2+2*mu_CO-2*mu_CO2)/(8.314*T));

Finally, I need to use Kp_new to calculate new x, new T, new mu. The iteration number is supposed to be 20.

I will appreciate if someone can help me on this problem!

Opportunities for recent engineering grads.

Apply TodayFind the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
## 13 Comments

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611105

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611105

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611108

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611108

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611109

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611109

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611114

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611114

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611199

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611199

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611200

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611200

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611207

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611207

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611230

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611230

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611231

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611231

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611235

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611235

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611355

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611355

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611449

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611449

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611452

⋮## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/419247-how-to-write-a-for-loop-for-the-following-task#comment_611452

Sign in to comment.