1

下の図に示すように、可変標準偏差 (シグマ) と可変平均 (ミュー) を持つガウス ノイズ モデルを出力曲線に追加したいと考えています。

http://i.imgur.com/hABfsiC.jpg

次の関数は、上の図で表される出力曲線を生成します

function c_t = output_function_constrainedK2(t, a1, a2, a3,b1,b2,b3,td, tmax,k1,k2,k3)

K_1   = (k1*k2)/(k2+k3);
K_2   = (k1*k3)/(k2+k3);
DV_free= k1/(k2+k3);


c_t = zeros(size(t));

ind = (t > td) & (t < tmax);


c_t(ind)= conv(((t(ind) - td) ./ (tmax - td) * (a1 + a2 + a3)),(K_1*exp(-(k2+k3)*t(ind)+K_2)),'same');


ind = (t >= tmax);


c_t(ind)= conv((a1 * exp(-b1 * (t(ind) - tmax))+ a2 * exp(-b2 * (t(ind) - tmax))) + a3 * exp(-b3 * (t(ind) - tmax)),(K_1*exp(-(k2+k3)*t(ind)+K_2)),'same');



plot(t,c_t);
axis([0 50  0 1400]);
xlabel('Time[mins]');
ylabel('concentration [Mbq]');
title('Model :Constrained K2');
end

上記の関数の出力値は次のとおりです。

 output_function_constrainedK2(0:0.1:50,2501,18500,65000,0.5,0.7,0.3,...
 0.28,0.9,0.014,0.051,0.07)

ここで、変数標準偏差シグマと平均値を使用したガウス確率分布関数を上記の関数に追加したいと思います。誰かがこれを手伝ってくれませんか。私は matlab の初心者です。

4

1 に答える 1

0

これらの行の間

c_t(ind)= conv((a1 * exp(-b1 * (t(ind) - tmax))+ a2 * exp(-b2 * (t(ind) - tmax))) + a3 * exp(-b3 * (t(ind) - tmax)),(K_1*exp(-(k2+k3)*t(ind)+K_2)),'same');

plot(t,c_t);

以下を追加

c_t = c_t + normrnd(mu,sigma,length(c_t),1)

normrnd 関数の詳細については、 normrndのドキュメントを参照してください。またはタイプ

help normrnd

matlab コンソールで。

編集して、最後のコメントに従ってこの回答を修正します。

c_t を以前のままにして、新しいベクトルを作成する必要があります。

c_t_noise = c_t + normrnd(mu,sigma,1,length(c_t))

また、次元に合わせて、normrnd のパラメーターの順序を変更しました。2 つの曲線をプロットするには、次のように拡張プロットを使用します。

plot(t,c_t, t,c_t_noise)

または、このようにホールドします

plot(t,c_t)
hold on %tells matlab to put plots in the same figure
plot(t,c_t_noise)
hold off %this line if you pretend to make some other plot, desactivate hold on

matlab コンソールの「保留」機能の詳細

help hold
于 2014-04-09T00:51:39.823 に答える