これをプロットしたい
f(x)=3*(1-x)+7*x+8.314*T((1-x)*(lnx)+x*(lnx))+20*x(1-x)
から~までT
変化し、間隔は{合計 20 個のグラフがすべて同じ}0
2000
100
for ループとプロット関数を含む非常に基本的なコードを示します。PS : 私はの初心者ですMATLAB
これをプロットしたい
f(x)=3*(1-x)+7*x+8.314*T((1-x)*(lnx)+x*(lnx))+20*x(1-x)
から~までT
変化し、間隔は{合計 20 個のグラフがすべて同じ}0
2000
100
for ループとプロット関数を含む非常に基本的なコードを示します。PS : 私はの初心者ですMATLAB
WordPress へようこそ。:) ループなしでこれを行う方法は次のとおりです。
% Define your function in terms of x and T
% Note that we use .* instead of * - this does a pairwise multiply
% instead of a matrix or vector multiply
f = @(x,T) 3*(1-x)+7*x+8.314*T.*((1-x).*log(x)+x.*log(x))+20*x.*(1-x);
% Set your domain
x = linspace(0, 10, 101);
T = (0:100:2000);
% Compute your function for all values of x and T
tmp = bsxfun(f, x, T');
% Plot your output, all at the same time
plot(x, tmp)