Create and rotate a vector field out of two matrices (x and y component)
Show older comments
Dear all,
my questions referes to the rotation of a vector field that consists of two matrices (data2_va1 and data2_var2). The dimenson of both matrices is 61x43.
Using a minimal exampe, it works out quite fine.
v=[data2_var1(1,1),data2_var2(1,1)];
theta = 90;
R = [cosd(theta) -sind(theta); sind(theta) cosd(theta)];
vR=v*R;
However, trying to use the piece of code to create a vector field v results in the following error message: Subscripted assignment dimension mismatch. Maybe somebody could give me a hint, how to construct a proper vector field out of two matrices (x and y component are seperated in the matrices data2_var1 and data2_var2).
for i=1:size(data2_var1,1)
for j=1:size(data2_var1,2)
v(i,j)=[data2_var1(i,j),data2_var2(i,j)];
end
end
theta = 90; R = [cosd(theta) -sind(theta); sind(theta) cosd(theta)]; v1R(i,j)=v1(i,j)*R;
Thanks a lot in advance, Fernandes
Accepted Answer
More Answers (0)
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!