how rotate a number as an vector in quiver plot?
Mostra commenti meno recenti
Hi all, I am having a very strange issue with rotating vector along the circle that I cannot seem to debug - I am hoping fresh eyes will help. The problem is best described if I explain it as follows:
r=1; % radius of nodes in cm
n=9; % number of (equally spaced) nodes around the half-circumference
theta=-pi/2:pi/(n-1):+pi/2;% angular position from 12 o'clock
x=r*sin(theta)';
y=r*cos(theta)';
%%Type in modal matrix (i.e. mode shapes are columns)
% Dummy data for you to replace
w=[4.03,-2.75;4.8,-1.17;4.41,-1.5;4.29,-2.42;
3.86,-2.88;3.53,1.31;3.39,1.3;
3.29,1.46;4.56,1.7];
% Set in-plane components of motion to zero since they are unmeasured
u=zeros(size(w));
v=zeros(size(w));
% Type in the natural frequencies here
fn=[171,245];
for ii=1:length(fn)
figure(ii)
quiver(y,x,v(:,ii),w(:,ii))
hold on
plot(y,x,'-r','Linewidth',3) % overlay geometry
title(['Mode shape of ', num2str(fn(ii)),' Hz mode'])
xlabel('x (cm)')
ylabel('y (cm)')
end
I want the vector be on the circumference of the circle but has an direction that likes passing from the centre of the circle instead of being perpendicular at each point to the circumference of the circle.
3 Commenti
Adam Barber
il 10 Ago 2015
Hey Paul,
If I understand correctly, you want arrows that point away from the curve on your plot.
In order to do so, you only need to define the "u" and "v" inputs to "quiver' such that they point in the direction you want. This turns out to be quite easy as you already have those directions as "y" and "x".
For example, if you replaced your call to "quiver" with the following:
quiver(y,x,y,x);
You will see the arrows point away from the center of the circle.
The documentation for "quiver" might be helpful here: http://www.mathworks.com/help/matlab/ref/quiver.html
One thing to note is that this does not change with "fn" or "w" because it is unclear to me what these are doing in the code. The only thing that changes with "fn" is "w", but since "v" is always zero, the vectors are only pointing up as that is the only component they have.
Hope this helps,
-Adam
Paul
il 11 Ago 2015
Paul
il 11 Ago 2015
Risposte (0)
Categorie
Scopri di più su Vector Fields in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!