ans = 1. -->exec("simulate1.sci") -->function op=simulate1(ip); -->K=1; W=100; l=100; -->[ig,N]=size(ip); -->for i=2:N-1 -->b=ip(i-1)-ip(i+1); -->roo=(b+sqrt(b^2 +4*ip(i+1)^2))/2; -->op(1,i)=roo; -->end; -->op(1,1)=ip(1); -->op(1,N)=ip(N); -->return; Warning : redefining function: simulate1 . Use funcprot(0) to avoid this message -->ip=[2 3 3 3 4] ip = 2. 3. 3. 3. 4. -->X=[]; for i=1:100 op=simulate1(ip); X=[X;op]; ip=op; end; -->X X = 2. 2.5413813 3. 3.5311289 4. 2. 2.5413813 3.0707638 3.5311289 4. 2. 2.5817039 3.0707638 3.5622752 4. 2. 2.5817039 3.105571 3.5622752 4. 2. 2.6015992 3.105571 3.5777079 4. 2. 2.6015992 3.1227892 3.5777079 4. 2. 2.6114553 3.1227892 3.5853696 4. 2. 2.6114553 3.13133 3.5853696 4. 2. 2.6163477 3.13133 3.5891768 4. 2. 2.6163477 3.1355723 3.5891768 4. 2. 2.6187786 3.1355723 3.5910695 4. 2. 2.6187786 3.1376809 3.5910695 4. 2. 2.6199871 3.1376809 3.5920107 4. 2. 2.6199871 3.1387293 3.5920107 4. 2. 2.620588 3.1387293 3.5924787 4. 2. 2.620588 3.1392507 3.5924787 4. 2. 2.6208868 3.1392507 3.5927115 4. 2. 2.6208868 3.1395099 3.5927115 4. 2. 2.6210354 3.1395099 3.5928273 4. 2. 2.6210354 3.1396389 3.5928273 4. 2. 2.6211093 3.1396389 3.5928849 4. 2. 2.6211093 3.139703 3.5928849 4. 2. 2.6211461 3.139703 3.5929135 4. 2. 2.6211461 3.1397349 3.5929135 4. 2. 2.6211644 3.1397349 3.5929277 4. 2. 2.6211644 3.1397508 3.5929277 4. 2. 2.6211735 3.1397508 3.5929348 4. 2. 2.6211735 3.1397587 3.5929348 4. 2. 2.621178 3.1397587 3.5929383 4. 2. 2.621178 3.1397626 3.5929383 4. 2. 2.6211803 3.1397626 3.5929401 4. 2. 2.6211803 3.1397646 3.5929401 4. 2. 2.6211814 3.1397646 3.592941 4. 2. 2.6211814 3.1397655 3.592941 4. 2. 2.6211819 3.1397655 3.5929414 4. 2. 2.6211819 3.139766 3.5929414 4. -->plot(X(:,2)) -->plot(X(:,3),'m') -->plot(X(:,4),'r') -->legend("cell2","cell3","cell4") ans = Handle of type "Legend" with properties: ======================================== parent: Axes children: [] visible = "on" text = ["cell2";"cell3";"cell4"] font_style = 6 font_size = 1 font_color = -1 fractional_font = "off" links = ["Polyline";"Polyline";"Polyline"] legend_location = "in_upper_right" position = [0.7208871,0.1334074] line_mode = "on" thickness = 1 foreground = -1 fill_mode = "on" background = -2 clip_state = "off" clip_box = [] user_data = []