I met a problem when I tried to update only one component in a vector fespace, for example
During the calculation, z may become greater than 1, but I want to limit z in the range between 0 and 1 (I want to make z=z*(z<=1)+1*(z>1)) after each iteration, how can I do it?
I thought about several methods. I tried to understant the componet in the array ux and only updated the z componet in the ux, but I didn’t find the pattern of z component in the ux for this [P2,P2,P1] fespace… (I use wz=z , and find that the componet of wz apprears in the 7th,10th,25th,34th … componets in the array ux. There seems to be no pattern…)
Thanks very much~
Maybe this is what you are looking for?
[ux,uy,z] = [ux,uy, z*(z<=1)+1*(z>1)) ];
It really works！！！