matlab - Predefining one element of a row matrix where other elements are created via an equation -
i have matrix created via equation
for xxx = 1 : xmid_p - 2 ln_p(1,xxx) = abs(radius_p(1,1) - radius_p(xxx+1)); end
however need equation have 0 first element. understand can via
ln_p(1,1) = 0;
but how combine first element 0 , rest of row matrix taken equation above.
solution:
it pretty simple , involved concatenating simple 1x1 matrix ln_p matrix.
lnzero(1,1) = 0 xxx = 1 : xmid_p - 2 ln_p(1,xxx) = abs(radius_p(1,1) - radius_p(xxx+1)); end ln_p = horzcat(lnzero,ln_p)
dirty trick maybe; use inside loop -
ln_p(1,xxx) = (xxx~=1).*(abs(radius_p(1,1) - radius_p(xxx+1)));
Comments
Post a Comment