MATLAB: Matlab/simulink error (Mismatched varying and fixed sizes indicate a probable run-time error.)

mismatchruntime errorvarying

Hello,
I'm trying to replicate a model of the dfig controller of a wind turbine using neural networks and for some reason I'm getting an error that I cannot fix.
Size mismatch (size [1 x 6] ~= size [:? x 6]). Mismatched varying and fixed sizes indicate a probable run-time error. If this diagnostic is incorrect, use indexing to explicitly make the varying size fixed.
This is where I'm getting the errors in my code
e=t1-J; wct=[wc(1) wc(2) wc(3) wc(4) wc(5) 0]; del_wa1 = lr*-(e*p*(0.5*(1-J^2))*(wct'*wc1*0.5*(1-o^2))); del_wa1t=del_wa1*tr; ERROR!!!!!!!! wa1 = wa1 + del_wa1t; g=p*tr'; %to create a vector from variable p
v=[m(1) m(2) m(3) m(4) 0 0]'; del_wa = lr*-(e*wa1*v*(0.5*(1-J^2))*(0.5*(1-p^2))*(wct'*wc1*(0.5*(1-o^2)))); f=del_wa*tr1; ERROR!!!!!!! wa = wa + f;
wc1 is a persistent variable; rand(1,6) t1, lr and J are scalars p and o are also scalars wa1 is a persistent variable; rand(1,6) tr=ones(1,6) wa is a persistent variable; rand(1,4) wc is a persistent variable; rand(1,5)
wa and wa1 are variables that must be continouusly updated
Can anyone give a hand with this, please?

Best Answer

The command
whos
will show the dimensions of all quantities
To multiply two column vectors with the same dimensions
EITHER use .* instead of * and get a vector of the same size
c = a .* b % size(c)=size(a)=size(b)
OR transpose the first one before multiplying and get a scalar
d = a' * b % size(c) = [ 1 1 ].
Notice that
d = sum(c)
Hope this helps.
Thank you for formally accepting my answer
Greg
Related Question