how to evaluate equation at different values?

10 ビュー (過去 30 日間)
Omar B.
Omar B. 2021 年 9 月 20 日
編集済み: Omar B. 2021 年 9 月 21 日
I'd like to find and save x at different values of mu.
Itried to write mu=linspace (2.4,4,1000) but I did not know how to complete the code.
Can you please help me.
mu=linspace(2.4,4,1000);
x(1)=.5;
for i=1:10
x(i+1)=mu*x(i)*(1-x(i));
end

回答 (1 件)

KSSV
KSSV 2021 年 9 月 20 日
mu=linspace(2.4,4,1000);
x = zeros(size(mu)) ;
x(1)=.5;
for i=1:10
x(i+1)=mu(i)*x(i)*(1-x(i));
end
plot(mu,x)
  5 件のコメント
Walter Roberson
Walter Roberson 2021 年 9 月 20 日
mu_min=2.4; mu_max=4; %range of mu values
n_mu=500; %number of mu pixels
n_x=400; %number of x pixels
mu_edges=linspace(mu_min,mu_max,n_mu+1); %edges of mu pixels
mu=(mu_edges(1:n_mu)+mu_edges(2:n_mu+1))/2; %values of mu on which to perform computation
x_edges=linspace(0,1,n_x+1); %edges of x pixels
n_trans=200000; %transient iterations
n_data=100000; %number of x values per mu value
x_data=zeros(n_data,n_mu); %x-data used to construct figure
num_mu = length(mu);
x(1,1:num_mu)=0.5; %initial condition
%---------------------------
for i=1:30 %should be n_trans
x(i+1, :) = mu .* x(i, :) .* (1-x(i,:));
end
plot(x)
Omar B.
Omar B. 2021 年 9 月 20 日
編集済み: Omar B. 2021 年 9 月 20 日
Thank you so much.

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

カテゴリ

Help Center および File ExchangeDenoising and Compression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by