I imagine by ‘omega’, you actually intend:
A while loop is best used if you want to increment it and then test to see if a specific value meets a specific criterion, and stop the loop when it does.
If you just want to increment it over a range without testing, use a for loop instead.
I experimented with vectorising your code by making ‘omega’ a vector and using element-wise operations where I could. It works for some calculations, but it makes the ‘xx’ calculation impossible. A loop is likely the only way to go.
I could not run this because ‘C’ and ‘a’ are not defined. Correct that, then see if this works for you:
theta=120;
sign=(cosd (theta)/abs (cosd (theta)));
u=.8;
wv = linspace(0, (2*pi/5), 10);
R=1;
c=4.05/12;
H=18/12;
y=H-(R*sind(theta/2));
Md=50/32.2;
Id=(.5*Md*R^2);
Mp=75/32.2;
Mb=30/32.2;
alpha=0;
u=.8;
L=(6/12*R);
g=32.2;
for k1 = 1:length(wv)
w = wv(k1);
ax = (-R*w.^2)*cosd(theta);
ab = (-R*w.^2*cosd(theta))-(R*w.^2*sind(theta));
ay = (-R*w.^2)*sind(theta);
AA=[1 0 1 0 0 0 0 0 0; 0 1 0 1 0 0 0 0 0; 0 0 -R*sind(theta) R*cosd(theta) 0 0 0 0 0; 0 0 0 0 1 0 1 0 0; 0 0 0 0 0 1 0 1 0; 0 0 -1 0 -1 0 0 0 0; 0 0 -c 3*R -c -3*R 0 0 0; 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0];
CC=[0 Md*g Id*alpha 0 Md*g Id*alpha Mp*ax Mp*ay+Mp*g Mb*g];
xx=CC*AA;
if (0<theta) & (theta<180), x{k1} = C*a;
else xx{k1} = CC*AA
end
end
I left ‘x’ and ‘xx’ as cell arrays because I don’t know how large they are.