Normal distribution function in Matlab

1 回表示 (過去 30 日間)
JACINTA ONWUKA
JACINTA ONWUKA 2020 年 11 月 20 日
コメント済み: Star Strider 2020 年 11 月 20 日
Please help
p was changed to a normal and is giving me the error "Matrix dimensions must agree." in tau.
t0=0;
L=1;
tend=100;
I=linspace(0, 1);
p = normrnd(0.0001,0.0001,[1,10])
beta=0.1;
delta=1;
I1=0.25;
epsilon=1;
tau = (1/(beta*(L+delta*p)))*log((L*(I1+delta*p))/(delta*p*(L-I1)))
t1=linspace(0,tau);
t2=linspace(tau,tend);
I2= (L*delta*p*(exp (beta*(L+delta*p)*t1)-1)) ./ (L + delta*p* exp(beta*(L+delta*p)*t1));
I3= (L* (I1+delta*p)*exp((epsilon*beta)*(L+delta*p)*(t2-tau))-...
delta*p*(L -I1))./(L-I1+(I1+delta*p)*exp(epsilon*beta*(L+delta*p)*(t2-tau(delta))));
plot(t1,I2,'k',t2,I3,'k');

採用された回答

Star Strider
Star Strider 2020 年 11 月 20 日
Use element-wise operations on every multiplication, division (and exponentiation, although not used here).
This works:
tau = (1./(beta.*(L+delta.*p))).*log((L.*(I1+delta.*p))./(delta.*p.*(L-I1)));
See Array vs. Matrix Operations for details.
  2 件のコメント
JACINTA ONWUKA
JACINTA ONWUKA 2020 年 11 月 20 日
thanks so much for your quick reply
another error "Inputs must be scalars."
t1=linspace(0,tau);
Can you please advice me on what to do?
Thanks!
Star Strider
Star Strider 2020 年 11 月 20 日
Provide all scalar inputs to linspace.
Perhaps:
t1=linspace(0, max(tau), numel(tau));
t2=linspace(min(tau), max(tau), tend);
These are obviously just guesses.
I have no idea what you are doing, so make appropriate changes to get the result you want.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by