Plotting magnitude of a vector

Given a vector [ux, uy] as the solution to a variational problem, is there any way to plot sqrt(ux^2+uy^2)?
I can’t find anything in the documentation nor in this forum, which seems really strange compared to how common a thing it should be.

So common that it writes literally as you want it to be written.

mesh Th = square(10, 10);
fespace Wh(Th, [P2, P2]);
fespace Vh(Th, P2);
Wh [ux, uy] = [x, y];
Vh magnitude = sqrt(ux^2+uy^2);
plot(magnitude);
1 Like

I see, I tried to do that inside the plot function and it didn’t work, didn’t think about declaring and initilizing it first. Thanks!