i would like to plot an iterative function
    6 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
f(x) =kx(1-x) , 3.5<k<4.0 , 0<x<1 . in steps of .0001
0 Commenti
Risposta accettata
  Adam Drake
      
 il 21 Feb 2023
        
      Modificato: Adam Drake
      
 il 21 Feb 2023
  
      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
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




