Plotting from a for loop- discrete maps
조회 수: 13 (최근 30일)
이전 댓글 표시
I'm just playing around with discrete maps (i.e. the logistic map). I seem to be having an issue plotting my data; It seems to only plot the last data point. Any suggestions?
function [x] = logistic(lambda,x0,n)
x(1) = x0;
for i= 1:n
x(i+1) = lambda*x(i)*(1-x(i));
z = [i,x(i)];
disp(z);
end
plot(z,'+');
end
Thank you in advance
댓글 수: 0
채택된 답변
Birdman
2020년 3월 27일
function [x] = logistic(lambda,x0,n)
x(1) = x0;
for i= 1:n
x(i+1) = lambda*x(i)*(1-x(i));
z(i,:) = [i,x(i)];
disp(z);
end
plot(z(:,1),z(:,2),'+');
end
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!