I have an expression such as s=aU+bV, where a and b are scalars and U and V 3-component vectors. The output s is clearly a 3-component vector. Let's assume I want to plot the first component of s find out how this varies when I change a and b.
In order to plot I have to use surf, which takes matrices for the variables a b. So I attempt to create matrices with meshgrid:
A=0:10;
B=1:10;
[a,b]=meshgrid(A,B);
U=[1,1,0];
V=[1,0,1];
s = a*U + b*V;
This clearly doesn't work, because nor the matrix product nor the element-wise product are well defined in this case. How do I actually make the matrices which represent the grid a b multiply element-by-element the vectors U and V?
s, all you need to do is use the first component ofUandV. Why complicate things? - Cris Luengo