MATLAB: Importing data at a regular interval for analysis

arraycsvcsvreadincrementation

Say I have an array in a .csv file like this:
a,b,c,d,e,f
20,1,10,100,1000,100
21,2,20,200,2000,200
22,3,30,300,3000,300
23,4,40,400,4000,400
24,5,50,500,5000,500
25,6,60,600,6000,600
and I want to solve this set of equations for g, h, and k:
f(a)=((((b-c)*g)/((d-e)*h))^f)+k
f(a+1)=((((b-c)*g)/((d-e)*h))^f)+k
f(a+2)=((((b-c)*g)/((d-e)*h))^f)+k
If I wanted to solve this set of equations using the values in the first three rows of data, and then solve the same three equations using the values in the second three rows and continue the evaluation for n rows of data, how would I set that up? I was thinking of defining each term in the equation as a csvread (b=csvread(filename, row, column)), but I don't know hot to handle the reading of different rows by a regular increase (3 rows at a time through the whole dataset). Any ideas?
Thanks.

Best Answer

What are you actually trying to accomplish? Is it to solve a sequence of systems of three (highly) non-linear equations defined more or less by
G(X, Y1) == 0
G(X, Y2) == 0
G(X, Y3) == 0
in which X=[g,h,k], Y=[a,b,c,d,e,f], and
f1 = @(x, y) x ./ y;
f2 = @(x, y, z) (x - y) .* z;
f3 = @(x, y, z, w) f1(x, y).^z + w
f4 = @(b, c, d, e, f, g, h, k) ...
f3(f2(b, c, g), f2(d, e, h), f, k) - f
G(X,Y) = f4(Y(2), Y(3), Y(4), Y(5), Y(6), ...
X(1), X(2), X(3))
If so, you need to devise a method for solving a single such system given a particular set of parameters a..k . Then, solving a sequence of such systems is a trivial loop (typically stride three) over the rows of the data matrix input using csvread.
If the above is not what you're after, then you will need to be a lot more precise concerning what you want to accomplish. And do, please, include the details of what you've done so far.
Related Question