Here,I have a pre-defined function called 'intersections(x,....) that finds the intersections between 2 functions of x.Now,for each iteration of the loop,I get a set of (x,y1) and (x,y2) values.(adsbygoogle = window.adsbygoogle || []).push({});

I want to store them in an array without losing the previous iteration's values. So,I figured I'd use a cell array except I can't decipher its working mechanism.Someone,please help me with this.

Have a looksie at the code below.

for i=1:5

for j=1:5

%functions f1 and f2

y1=@(x)C.*(x)./((x.^p)+1);

y2=@(x)(r.*(1-(x./q)));

[a{i,j},b{i,j}] = intersections(x,y1(x),x,y2(x),1);

%a line of plot commands follow[not important]

end

end

I initially used

[xout,yout]= intersections(x,y1(x),x,y2(x),1);

to store the coordinates of the intersections but it kept getting erased out after each iteration.I want the whole data stored coordinates stored in 1 cell array.

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Cell arrray that stores with iteration a new set of values

Loading...

Similar Threads for Cell arrray stores |
---|

Mathematica Storing Mathematica output |

**Physics Forums - The Fusion of Science and Community**