0
votes

I have an excel file in my matlab folder containing 9 columns with data. Each column is another variable in my formula.

I would like to do the following: - associate a specific column in excel with a specific variable in matlab: - `% define variables m1=xlsread('jongens0','B:B'); m2=xlsread('jongens0','C:C'); m3=xlsread('jongens0','D:D'); m4=xlsread('jongens0','E:E'); m5=xlsread('jongens0','F:F'); m6=xlsread('jongens0','G:G'); m7=xlsread('jongens0','H:H'); m8=xlsread('jongens0','I:I');

Next I calculate my growth function

tmin=0;
tmax=20;
dt=1/100;
t = tmin:dt:tmax;
y = m1.*(1-1./(1+(m2.*(t+m8)).^m5+(m3.*(t+m8)).^m6+(m4.*(t+m8)).^m7));

next I calculate the velocity function (the first derivate)

%velocityfunction
dy=diff(y)./dt;

next I use the following commands to obtain the minimum and maximum velocity as also the time and growth at this time:

max(dy);
min(dy) if t<12;
imax = find(dy==max(dy)) + 1;
imin = find(dy==min(dy)) + 1;

t(imax);
t(imin);
y(imax);
y(imin);

If i enter this in the matlab command window i get the following error: Error using + Matrix dimensions must agree.

Can somebody point me out what I am doing wrong?

Thanks

1
Sounds like t is a different length from the variables m1...8. I'm assuming, here, that it's giving you this error on the line y = ... (you haven't actually stated which line causes the error in the question) - wakjah
t is inderdeed a different length. t is my independent variable. m1 to m8 are numbers that change for every subject. How can I see which line causes the error? Thanks for answering - user1719126

1 Answers

0
votes

You're adding vectors that are different sizes. When you add t to one of your m vectors, are the m vectors the same size as t?

You can output the length of all your variables that participate in the add operation to debug. If that doesn't do it, use the size function. A 1xm and an mx1 matrix won't add either.