quiver3 in a loop

1 view (last 30 days)
Oday Shahadh
Oday Shahadh on 20 Jun 2020
Commented: KSSV on 20 Jun 2020
hi
I have (bbhat ) size(150,3) and (vvhat) size(150,3)
both vectors have the same size
I tried this:
for ii = 1:length(bbhat);
quiver3(bbhat(ii,1),bbhat(ii,2),bbhat(ii,3),vvhat(ii,1),vvhat(ii,2),vvhat(ii:3),0.5);hold on
end
I got this error
Error using quiver3 (line 43)
V and W must be the same size.
pls help
  1 Comment
Oday Shahadh
Oday Shahadh on 20 Jun 2020
size(bbhat)
ans =
105 3
>> size(vvhat)
ans =
105 3

Sign in to comment.

Accepted Answer

KSSV
KSSV on 20 Jun 2020
There is a typo error ..you have used vvhat(ii:3) instead of vvhat(ii,3)
for ii = 1:length(bbhat);
quiver3(bbhat(ii,1),bbhat(ii,2),bbhat(ii,3),vvhat(ii,1),vvhat(ii,2),vvhat(ii,3),0.5);hold on
end
Also note that you need not to use loop for this..you should plot all at once.
quiver3(bbhat(:,1),bbhat(:,2),bbhat(:,3),vvhat(:,1),vvhat(:,2),vvhat(:,3),0.5);hold on
  2 Comments
Oday Shahadh
Oday Shahadh on 20 Jun 2020
thanks you are great
KSSV
KSSV on 20 Jun 2020
Thanks is accepting answer.:)

Sign in to comment.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!