# Thread Subject: Constructing the initial vector

 Subject: Constructing the initial vector From: Sanaa Date: 1 Jul, 2012 19:52:07 Message: 1 of 5 Hi, I am having a problem in constructing the initial vector in my code clear all; close all; n = 50; Nit = 10; ru=1.5;      x_previous = ones(1,n);      for i = 1: Nit       time = linspace(i,(i+1),n);         x_next = x_previous+(time(i)-i)*ru*x_previous.*(1-x_previous);         x_previous = x_next;         plot(time,x_next,'linewidth',3)      end fsize=15; xlabel('t','Fontsize',fsize) ylabel('x','Fontsize',fsize) the problem is in x_previous which will keep x_next as it is. I mean (1-x_previous) will be always zero. Any help is really appreciated. Thanks a lot Sanaa Moussa
 Subject: Constructing the initial vector From: Matt J Date: 1 Jul, 2012 23:33:06 Message: 2 of 5 "Sanaa" wrote in message ... > > > the problem is in x_previous which will keep x_next as it is. I mean (1-x_previous) will be always zero. ============= Yes, that's pretty clear. But, if you know where the problem is, what advice are you looking for? Who other than you can know how the sequence is really supposed to evolve?
 Subject: Constructing the initial vector From: Sanaa Date: 2 Jul, 2012 07:34:15 Message: 3 of 5 "Matt J" wrote in message ... > "Sanaa" wrote in message ... > > > > > > the problem is in x_previous which will keep x_next as it is. I mean (1-x_previous) will be always zero. > ============= > > Yes, that's pretty clear. But, if you know where the problem is, what advice are you looking for? Who other than you can know how the sequence is really supposed to evolve? Thanks a lot for replying. I need a hint to initialize my vector. when I tried x_previous=2*ones(1,n), or 0*ones(1,n) the problem is not solved. When I use rand(1,n) I get a different plot each time. So I need an advice on how to start please.
 Subject: Constructing the initial vector From: Matt J Date: 2 Jul, 2012 13:40:07 Message: 4 of 5 "Sanaa" wrote in message ... > > > Yes, that's pretty clear. But, if you know where the problem is, what advice are you looking for? Who other than you can know how the sequence is really supposed to evolve? > > Thanks a lot for replying. I need a hint to initialize my vector. when I tried x_previous=2*ones(1,n), or 0*ones(1,n) the problem is not solved. When I use rand(1,n) I get a different plot each time. So I need an advice on how to start please. =============== I think I wasn't clear before. The algorithm you have shown looks neither familiar nor famous, at least not to me. Because the algorithm and its purpose are unknown, it is impossible to advise you on how to initialize it. What is clear is that the algorithm has many fixed points. Any initial vector consisting of 1s and 0s, will be a fixed point and the algorithm will not move from there. Therefore, whatever the algorithm is meant converges to (assuming it does) will depend greatly on the initial point, and the person who developed the algorithm probably specified in some detail what kind of initial point should be chosen. You should probably go back to the paper or textbook that introduced the algorithm to see what details on initialization were given there.
 Subject: Constructing the initial vector From: Sanaa Date: 3 Jul, 2012 16:37:06 Message: 5 of 5 "Matt J" wrote in message ... > I think I wasn't clear before. The algorithm you have shown looks neither familiar nor famous, at least not to me. Because the algorithm and its purpose are unknown, it is impossible to advise you on how to initialize it. > > What is clear is that the algorithm has many fixed points. Any initial vector consisting of 1s and 0s, will be a fixed point and the algorithm will not move from there. Therefore, whatever the algorithm is meant converges to (assuming it does) will depend greatly on the initial point, and the person who developed the algorithm probably specified in some detail what kind of initial point should be chosen. You should probably go back to the paper or textbook that introduced the algorithm to see what details on initialization were given there. Thanks a lot for your advice. I think I was able to modify the code. However, I am still having a question in my mind. I am having here the time explicitly, So should I get a continuous curve ? or stairs like what I get. clear all; close all; r_vec = [1]; color_vec = ['k']; rho = 1; n = 100; Nit = 30; figure(1); hold on for j = 1 : length(r_vec)      for i = 1: Nit-1      time = linspace(i*r_vec(j),(i+1)*r_vec(j),n);         x_next = x_previous+(time(i)-i) *rho*x_previous.*(1-x_previous);         x_previous = x_next;         plot(time,x_next,char(color_vec(j)),'linewidth',3)      end end xlabel('t','Fontsize',fsize) ylabel('x','Fontsize',fsize) axis([1 Nit 0 1]); Thanks a lot for your help.

Separated by commas
Ex.: root locus, bode

### What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.