フィルターのクリア

i would like to plot an iterative function

1 回表示 (過去 30 日間)
dave
dave 2023 年 2 月 21 日
コメント済み: dave 2023 年 2 月 21 日
f(x) =kx(1-x) , 3.5<k<4.0 , 0<x<1 . in steps of .0001

採用された回答

Adam Drake
Adam Drake 2023 年 2 月 21 日
編集済み: Adam Drake 2023 年 2 月 21 日
xbounds = [0 1];
kbounds = [3.5 4.0];
stepsize = 0.0001;
X = xbounds(1):stepsize:xbounds(2);
K = kbounds(1):0.1:kbounds(2); % reduced k-step size for plot clarity
for j = 1:length(K)
for i = 1:length(X)
fofx(i,j) = K(j) * X(i) * (1 - X(i));
end
end
figure
for k = 1:length(K)
plot(X,fofx(:,k))
hold on
end
legend(num2str(K'),'location','south')
xlabel('x')
ylabel('f(x)')
hold off
  1 件のコメント
dave
dave 2023 年 2 月 21 日
Thank you Adam .

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

その他の回答 (1 件)

Matt J
Matt J 2023 年 2 月 21 日
編集済み: Matt J 2023 年 2 月 21 日
For example,
k=linspace(3.5,4.0,5);
x=0:0.0001:1;
for i=1:numel(k)
f =k(i).*x.*(1-x);
plot(x,f); xlabel x; ylabel f(x)
hold on
end
hold off; legend("k = "+k)
  1 件のコメント
dave
dave 2023 年 2 月 21 日
Thank you Matt.

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

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by