MATLAB: Create a vector with for loop with mathematical operations

for loopMATLABvectorvectors

w=[5 4 3 2]
Use this vector in a mathematical expression to create the following vectors:
My code snippet is below, code for that question. When I run it, I can't get expected result. I just want to create a vector as noted above.How can I solve that question?
w=[5 4 3 2]
for i= w
a3=[1/(i+i)]
b3 =[i^i]
c3 =[i/sqrt(i)]
d3 =[(i^2)/(i^i)]
end

Best Answer

Read about ., element by element operations.
w = [5 4 3 2] ;
a = 1./(w+w) ;
b = w.^w ;
c = w./sqrt(w) ;
d = w.^2./w.^w ;