turn a values into an array you can plot

Hello,
I need to develop an array of answers using solver and then plot these verse temperature.
My code looks like this:
T=230:10:630; %Temperature in Kelvin
R=8.3144621; %Gas constant in J/(K*mol)
x0=0.1;
for i=1:41
fun=@(X2) [10600-R.*T(i)*(log(1-X2)-log(X2))-21200.*X2];
x = fsolve(fun,x0)
end
% plot(x, T)
I need to take all the answers solved for x and put them into an array I can manipulate.
Please help.
Thank you,
Mike

 採用された回答

Star Strider
Star Strider 2012 年 10 月 27 日

0 投票

You need to create a vector out of x:
x(i) = fsolve(fun,x0);
Since x is a scalar at each step, this will work.

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 10 月 27 日

0 投票

Instead of assigning to x in the loop, assign to x(i)
Question: are you sure that you want T on your second axis, the y axis? The first axis is normally used for the variable being controlled, and the second axis is normally used for the variable being calculated. Which value is the "cause" and which is the "effect" ?

1 件のコメント

Mike
Mike 2012 年 10 月 27 日
Im trying to make a phase diagram. Need to hold T constant and solve for the min of a function.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

質問済み:

2012 年 10 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by