From: SM on
Hi everybody,
I have following matrices:
x=1:1:5;
y=1:1:3;
z=[1.0000 1.5000 1.3000 1.0000 3.0000
3.0000 2.0000 2.1000 4.0000 6.0000
2.0000 1.8000 1.1000 5.0000 3.5000];
I have an algorithm to fit a curve to z data.
for y=1, I fit my model to z(1,:)
for y=2, I take the average of(z(1:2),:) and then fit my model
for y=3, the model is fitted to the avearge of (z(1:3),:)

and plot all the steps in a 3d plot.

Now I want to modify my code to take all the data point to fit instead of the averaging them. I.e.
if y=1, fit model to z(1,:)
if y=2, then create z'(2,:)=[ 1 3 1.5 2 1.3 2.1 1 4 3 6]; and plot the z versus x'=1:1/2:5, and then fit my model
so the plotting x and z when y=2 will be:
(1,1),(1.5,3),(2,1.5),(2.5,2),(3,1.3),(3.5,2.1),(4,1),(4.5,3),(5,6)
for y=3 the same procedure with x=1:1/3:5;

and plot all these steps in one figure while fitting the model.

do you have any idea how to do this?
thanks in advance for any ideas.